mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-12-16 16:15

[QUOTE=CRGreathouse;242184]Yes -- natural1 would take a long, long time to do that. It took 4:59.8 to do 10^5; based on curve-fitting with smaller numbers I estimate it would take about a month for it to do 10^7.[/QUOTE]

yeah with my isprime check and forstep loop put/editted in this seems even faster as it reduces the work. I was just trying:

[CODE]natural2(10000000)[/CODE] which is natural with those replacements etc. it comes back with:

[CODE]*** last result computed in 7,344 ms.[/CODE] and even when i tried 100 million I was able to get every prime in under 1 min 20 I think.

CRGreathouse 2010-12-16 16:32

Let me see the code.

science_man_88 2010-12-16 16:35

[QUOTE=CRGreathouse;242193]Let me see the code.[/QUOTE]

[CODE]natural2(N)=my(l=List());forstep(n=5,N,[2,4],if(isprime(n),listput(l,n)));Vec(l);[/CODE]

did I mention I'm running cityville on Facebook as well lol.

science_man_88 2010-12-16 16:44

[CODE](12:43)>##
*** last result computed in 1mn, 18,328 ms.
(12:43)>natural2(100000000)[/CODE]

pretty quick.

CRGreathouse 2010-12-16 23:46

[QUOTE=science_man_88;242194][CODE]natural2(N)=my(l=List());forstep(n=5,N,[2,4],if(isprime(n),listput(l,n)));Vec(l);[/CODE]

did I mention I'm running cityville on Facebook as well lol.[/QUOTE]

So it's based on the fast natural, not the slow natural1. No surprise it's faster than natural1.

science_man_88 2010-12-17 00:01

[QUOTE=CRGreathouse;242235]So it's based on the fast natural, not the slow natural1. No surprise it's faster than natural1.[/QUOTE]

last I checked it was faster than the fast natural

CRGreathouse 2010-12-17 00:45

[QUOTE=science_man_88;242237]last I checked it was faster than the fast natural[/QUOTE]

Sure -- it doesn't add as many numbers.

science_man_88 2010-12-17 01:39

[QUOTE=CRGreathouse;242239]Sure -- it doesn't add as many numbers.[/QUOTE]

outside of the fact that the default list seems faster if I could get it fast enough could it ever replace the current one ?

CRGreathouse 2010-12-17 02:01

[QUOTE=science_man_88;242244]outside of the fact that the default list seems faster if I could get it fast enough could it ever replace the current one ?[/QUOTE]

I'm not sure what you're asking.

If the question is, "could some version of natural2 replace natural?", I'm not sure how to answer -- natural2 gives different output from natural, and natural itself is just a less-efficient version of vector(N,i,i) which doesn't have many uses anyway.

If the question is, "could some version of List replace List?", it's possible -- but that would have to be in C/PARI not gp.

science_man_88 2010-12-17 13:09

[QUOTE=CRGreathouse;242248]I'm not sure what you're asking.

If the question is, "could some version of natural2 replace natural?", I'm not sure how to answer -- natural2 gives different output from natural, and natural itself is just a less-efficient version of vector(N,i,i) which doesn't have many uses anyway.

If the question is, "could some version of List replace List?", it's possible -- but that would have to be in C/PARI not gp.[/QUOTE]

I'm talking [CODE]default(primelimit,x)[/CODE] seems faster than this script .

CRGreathouse 2010-12-17 22:49

[QUOTE=science_man_88;242291]I'm talking [CODE]default(primelimit,x)[/CODE] seems faster than this script .[/QUOTE]

Wow, that was random.

Sure. So is the program
[code]1[/code]


All times are UTC. The time now is 23:05.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.