Bill Allombert on Tue, 06 Feb 2024 19:08:31 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: nonprime(n)
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Tue, 6 Feb 2024 19:08:08 +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=1707242891; c=relaxed/relaxed; bh=sOVwXvyTkpaGguamj2xnFlqwVHBnJkiL1MbZXxffcEw=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=b0at+qvqdV0HyZdIrhEY3EfSJPLeVkzmhWEuBwBvRYH+b9W94URbm9vVye/Pls75BxkH8LIl4foM+1e/6hrYKLoGuYkW4aViuro3iHVJjB60PZoS/R+PUl7IDqJ99pU2dlRtEwncgktdf8XGJ9yt/KQ60motkgXj/yTEspEJalNNRxk2YbFYkiied1QA2ReB5T82VKkhhylgXskzw3C093k5qyD+LeBfnlDGlHRq9no0qtiT4Z8vB7ZFBAhVGBnBn9HlFxq26pSUs5Tn1DFIYRMTUS017OON12qAPDWGKgteDg1WH8Sza5x6xStItj4AFA6ZCVarSkNh3C2b9+4owKFEoIrkaSb2/VpBOlZC7BA/3x8VdPAE4Ocna/tDUNBdWNPZaSPvrnU8VsnBAeEI27N2TXReugBghHNqJLBrYnGfYm8sZCk9T7QIBDpC/bQ3m4I15ShN3PdPESkXCbnJekbd9ai9PI3WYRsZvvxOtuw2M6oTBRH6qW+hxbf9ThSwU2xZLoYNzhvnrYjDZ6T9kjKB1CTJbzM8t8nI0SuDYdpepoY1y8eUyCPbNzynnt0gOZG1/wcj4pKroW3HZBeZjYjSu/YwQJp7r2W+H+YQR5GbeUqaMkUG8eKRD4dy3pTQNkCsTEf9hmgsDrSorgh6sf+o8yEfieypfJX2EiHldWE=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1707242891; cv=none; b=oFaOapKFXGAqkEhDcUPctKzPVvmpO7G4V16PSKi5ozhksf1IBz17JC0hPcX06KCuLFe/JzCNGbGSKIevg8rWes5PCAWajYQUkE7rW47i1RfS/Qb2F2YJ8f59FW2eVZDyLebPCJZgGUq4CfyHI6xZDWi8HY2uX3Nff1sVzb7g2xeFcHLtfCCXstKOtOt3bEfG0mT0IVIwqppwXK2rKfDw/eJmggY0yKUYS6TsR5A9wIxfQO1IvCJuXYuEjaI42cL2ivFLMBQfPCqKYdc2OEurR5EO9LCmiCsjDfP8PlV8SuuJ76wQkl0/6dD2mb5eQEZv6gqtblYSpYXcWUCEGDIYMXTYupCzSnJrGeHbYzSY03oVT8RqN+MNYjedE2TiXi2ARJ2RKYPf6AwTXf9uZYo3pq+GbOv0rDo0d/o8OeHHmtYquXwfgDz9Xe85aH/3oxsbWq/MfuLPUL8iwYrB1rSu8wYXTSPXK8osT8s1q5G3ihmQlzLAiZy5aRKkSjp6eodlugQH9bCZqqjVSiAOu1lTmf/H0odt77MqXJijSu5xSb6RRaadUN/JEYPnZtyOzipPOTsOLR5NsbR5CAxsp/Mjus4FvirQu9iY9vlA5JTm06P//1BIlYpWVEulI3nhaDl7KF3CqLN9KfAH2JKmY5zTcy5o1JojAiw7hRUVnZcbLtQ=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Tue, 06 Feb 2024 19:08:31 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1707242891; bh=sOVwXvyTkpaGguamj2xnFlqwVHBnJkiL1MbZXxffcEw=; h=Date:From:To:Subject:References:In-Reply-To:From; b=lOZIpcCo7W1Uty9bzLvO+48YAwKW4XTuKxLq6RwV+2Q5lMGX0FGeS26w5Glwfk8PW gWnd0LJznp0GiRyg8X1xTs18ZfYOJUfPBwmqLk2HaofKM4m/0dyd2PDMAnVFB70cCS AGDi9CUCnewfYdeQ0cm3rmUOdaqV3paZJ03Uwmo7hq2vZqUvI5YTjzsCqSENMX4gAT hr6y+PZRnJ9xxIfuaoc6mb60Sh46PIAFY+Gg24I/j7JHCXwg0V7K8784HyqofzDztQ ZEa0FlPfJYtqbGUfi8iNwiR2xzz/ifOCLej7yE8y8eGEgC4zb9pbRtJD+N6m7eozyE Y1rR7xCToGuPtN3acqYHjopUGnuRQ9x3im1w4hNDgs94AI1BlWIr1hGOxX+yt6RYjs GHTDOCAjF7rqdj4z5bJ43T5Nof3Baqj9a3MGCA6L+vqVUEsfybqF6gJ74grEFZVolM +PWWHIKmmT/nKZNMN2Gfx2Lx+i/97H7d2q/xeYsLpE3T5DamYVQYm/eWGflwzr3CK2 Iyap9oglo0/mh+AS2LYNdKV63xbfRvFk7PuHGAz8Ha/I5CH/zkuzSjMgH9whKiR77G 018RE4eto1S4UoXXeGrYE1dihNYrfXksoiiPaGLN4/LD3hqQ3s0UDA6C4FHAzlCDW1 fInPfKHs4w9caeVq3VegzNk0=
- In-reply-to: <881a66d9f2f99ff39a04c441e2d2204c@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <cf9ba63c-87cc-4d0a-aded-8ac6ddb01c03@isolution.nl> <ca71cdf7-c294-42b0-985c-6044b9ff57c5@filmsons.com> <ZcEfRGHu02X3r4mS@seventeen> <6f7c35b5-4668-42e3-8943-55e67004a036@filmsons.com> <1afa6722-6270-4a8e-9585-a67e234c473f@normalesup.org> <881a66d9f2f99ff39a04c441e2d2204c@stamm-wilbrandt.de>
On Tue, Feb 06, 2024 at 06:14:47PM +0100, hermann@stamm-wilbrandt.de wrote:
> On 2024-02-06 08:40, Aurel Page wrote:
> > 257M is overkill.
> >
> > $ gp -p4M
> > ? for(n=1,2^18, prime(n));
> > time = 1,315 ms.
> >
> > We have all the necessary primes:
> > ? prime(2^18)
> > % = 3681131
> >
> > Cheers,
> > Aurel
> >
> And why is forprime() so fast without -p...?
>
> hermann@7950x:~$ gp -q
> ? c=0;forprime(p=2,oo,c+=1;if(c==2^18,print(p);break()));
> 3681131
> ? ##
> *** last result: cpu time 60 ms, real time 60 ms.
Compared to
? prime(2^18)
%1 = 3681131
*** last result computed in 5 ms.
this is not so fast.
the issue is that "for(n=1,2^18, prime(n))" does
for(n=1,2^18, c=0;forprime(p=2,oo,c+=1;if(c==n,break())))
which is a very inefficient way to do that computation.
Cheers,
Bill