Bill Allombert on Mon, 09 Jan 2023 00:02:39 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: lookup-optimization
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Mon, 9 Jan 2023 00:01:10 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1673218870; c=relaxed/relaxed; bh=ic85SI/JdCqu4Y+I+DSqlUulycNV0YhvlvY5PNf/0iM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; b=FCCTrRdaCak0GWW1KjPHt/B+DZhS8d6dLueV5/UyKHgG52kLAIKPhZVrg2pePRNEwyfwbcjGfCDm0eRfkbJXZH0hiPZepxp7I259VKPrJMwNQ50KyJQpXs1L01T/5ODNsq8u73gwvyAXnZeBGXHL0rLs8ASrIu6BX/w077lPQQllHfNRWtJw7TeOsXch1YOJ4cHaccpzD0zF44Jh4rQlEX3Uzz2dSoOQXRai91iAVCUF3B5bL9HXO90w1+zAMXGbax8VOTdhBWjEAnIZYnEZhlEMm6I6vzu8uancoqj8qxwQO4BCMJf/6DhX76ffEArhQ8X5+h2VBi/LFk6Xu3V8TytMcQb8jRJf8d3Uv56FRxsH1LQBSOAI7br/IE2lvOIkOfB1WwThPwcuJCpJwsQlo/BWVGZAEKAVh1lJbOePxSSakBIqH0A4b7Fm7UBD0NefGKdqQWOnX2NQANDneR2GN5/rjUsX2O5mwV/mFz2v2CAGqdsQFYnbN29Ma5/JEQV1W2ur57xipxvFrZU9h7L97wVOAfz+yATqdbKg0axq71ND/Us/clWkmohXlTV808Nnb0PMJVq4ubg0qPmZdfQJL64qWNC+tmePGxaHf36q9ViMLMiz2ZsUhJn93VmU01HxaO5DloCj416ejYILvB1T/k7n8v0c/AI/4gzKKy/viy4=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1673218870; cv=none; b=y+leEh2aCmBgrFXSOhtwdgINJ7ap4ZfbA1Wu3J2KODhQJQIEUZw7f8p/PE+rVpLR6HGooXagIShoqjILCjeu7pvDwdll8u9+Pcm2gXdllDxZN+PumKaN3W6nR3KYYH7qgJ06k3IYQ1E0JCB5syGasTq61GvGKg8MTMzbmvzhe3g4RyzzNIkoSPoOu41CtOGyx2ISkAglE+pNSmEwfvnWKArjUpleYRUIW3jgKMA9tH/utAfTpsAI6/wK5UMy9wDg60YCr9O15WOhrqFxs715e6wv/qIjhDeVZTMNYFUpXPhJRj/IQu6mSLlM6bQDsWiaabW7CzIYAtLr2AUQQT+taQEdzOK2OqJzakOF/ryu99uolP4OUCpbSNVvp2pE9ps7kDxLMxRrEE2vc5228GbB0bZLoDyGhidIM3xNru4Bd+/CH41z5BDUoqVZBqryi0f/zVU4nfpDyFovUIvW8euUmuWsPBh2Zqkdjs5plP2gREiOlgYhiv6Agc3XIwEH1RYNeIeFRCRQUF/QvpUx5e8YjC0xtCzpu2Mf7/QPPoRiN0p5veJVIJkdhL7hbMou8aA+Cz0M6gFmOHgRtQu4WauA++6tTuuWRnWzTpRbrdSNbWeIK+piGR/B6n7lBve+1jHB3zcLoQzWiuo1ERfDbKU83RAhdeS+hgk1JzKf9zihP1c=
- Authentication-results: smail; arc=none
- Delivery-date: Mon, 09 Jan 2023 00:02:39 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1673218870; bh=ic85SI/JdCqu4Y+I+DSqlUulycNV0YhvlvY5PNf/0iM=; h=Date:From:To:Subject:References:In-Reply-To:From; b=qngOlevbjtDa2JQWi3HFTViOJAdQnnMGmt6eC+zKXIu1dWJd6D4yz0/08IDPWdzcM gP4FtUmnt+EkTxeiS+xHado2ZwX8/bhj+NKj41X2++ZPiD0xjIY3dGBtwHonfi9lly mKinv3DzKmoAzGJtnF+v7WpOOJSB+hw4+yIB+YEbpK7iT8yRcLt3vtb8ASzVqAZbzp Tqcs7yGjLHS8Txc56iHc4FjsDep48deiO/hIhl3SFatoZbvHm3zVwW0h46z4FgAx0u au6xougdaM5404YY9W/tyYzX+opE3ylQ0jyHjell85RpxRAauY4LHWVxLWlhtzK0LA 49LMDjs+XNF08UhFQsyWwpFALodieAQTfSEgceTaYSzdUGVDl9VdviIIcvKHyBaGCo 5xM81ZF6qlv870tDRWQIdz03IgePiXOvam12V2RgKnOHLoLD0UuFj0FiBJvUr37p5Y 93b/9y1PiPcj6cvPc/diM64lDooGJojZqML6Wta8+5yVrZchyNBbkCgj0fD+rvg7U7 8kc1uuw1vPy0R2gu0pksGHQUIPmk9MFo3wI+s55SaUcldNvU9/zzPMegqbBlE6/5qL FTHDu2btvdZjw2iQc9DC/pq76yf5rTkjpJtyR6ygtG1as1z8uYYfjzoPodTNbCo7l6 6Ny4N/QseVGzTXulnWy+nHzE=
- In-reply-to: <Y7tH38HJYdPd6ON3@math.u-bordeaux.fr>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <3296bf3c-11ee-d3d5-89a8-9088af372b5d@isolution.nl> <Y7tH38HJYdPd6ON3@math.u-bordeaux.fr>
On Sun, Jan 08, 2023 at 11:46:55PM +0100, Karim Belabas wrote:
> A243115(N = 575) =
> { my(r= [], s= Map());
> forstep(v2 = 3, N, 4,
> my(found = 0);
> for (i = 1, #s,
> if (valuation(s[i][2] - v2, 2) >= s[i][1], found = 1; break));
> if (found, next);
>
> my(p2 = 0, v3 = v2);
> until (v3 <= v2,
> if (bitand(v3,1), v3 += v3 >> 1 + 1;
> , v3 >>= 1);
> p2++);
> r = concat(r, v2);
> s = mapput(~s, v2,p2));
> r;
> }
By merging with my version I get
A243115(N = 575) =
{ my(r= List(), s= Map());
forstep(v2 = 3, N, 4,
for(i=1,logint(v2,2)+1,
my(nv2=v2%2^i,p2);
if (mapisdefined(s,nv2,&p2) && nv2==v2%2^p2, next(2)));
my(p2 = 0, v3 = v2);
until (v3 <= v2,
if (bitand(v3,1), v3 += v3 >> 1 + 1;
, v3 >>= 1);
p2++);
listput(~r, v2);
mapput(~s, v2,p2));
Vec(r);
}
? A243115(10^5);
*** last result computed in 168 ms.
? A243115(10^6);
*** last result computed in 1,936 ms.
(concat is very slow!)
Cheers,
--
Bill Allombert
Ingénieur en calcul scientifique ❄
CNRS/IMB UMR 5251