![]() |
[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. |
Let me see the code.
|
[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. |
[CODE](12:43)>##
*** last result computed in 1mn, 18,328 ms. (12:43)>natural2(100000000)[/CODE] pretty quick. |
[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. |
[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 |
[QUOTE=science_man_88;242237]last I checked it was faster than the fast natural[/QUOTE]
Sure -- it doesn't add as many numbers. |
[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 ? |
[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. |
[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 . |
[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.