mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-12-16, 16:15   #2091
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
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.
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)
which is natural with those replacements etc. it comes back with:

Code:
***   last result computed in 7,344 ms.
and even when i tried 100 million I was able to get every prime in under 1 min 20 I think.
science_man_88 is offline   Reply With Quote
Old 2010-12-16, 16:32   #2092
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Let me see the code.
CRGreathouse is offline   Reply With Quote
Old 2010-12-16, 16:35   #2093
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Let me see the code.
Code:
natural2(N)=my(l=List());forstep(n=5,N,[2,4],if(isprime(n),listput(l,n)));Vec(l);
did I mention I'm running cityville on Facebook as well lol.
science_man_88 is offline   Reply With Quote
Old 2010-12-16, 16:44   #2094
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Code:
(12:43)>##
  ***   last result computed in 1mn, 18,328 ms.
(12:43)>natural2(100000000)
pretty quick.
science_man_88 is offline   Reply With Quote
Old 2010-12-16, 23:46   #2095
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

135338 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Code:
natural2(N)=my(l=List());forstep(n=5,N,[2,4],if(isprime(n),listput(l,n)));Vec(l);
did I mention I'm running cityville on Facebook as well lol.
So it's based on the fast natural, not the slow natural1. No surprise it's faster than natural1.
CRGreathouse is offline   Reply With Quote
Old 2010-12-17, 00:01   #2096
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
So it's based on the fast natural, not the slow natural1. No surprise it's faster than natural1.
last I checked it was faster than the fast natural
science_man_88 is offline   Reply With Quote
Old 2010-12-17, 00:45   #2097
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
last I checked it was faster than the fast natural
Sure -- it doesn't add as many numbers.
CRGreathouse is offline   Reply With Quote
Old 2010-12-17, 01:39   #2098
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Sure -- it doesn't add as many numbers.
outside of the fact that the default list seems faster if I could get it fast enough could it ever replace the current one ?
science_man_88 is offline   Reply With Quote
Old 2010-12-17, 02:01   #2099
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
outside of the fact that the default list seems faster if I could get it fast enough could it ever replace the current one ?
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.
CRGreathouse is offline   Reply With Quote
Old 2010-12-17, 13:09   #2100
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
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.
I'm talking
Code:
default(primelimit,x)
seems faster than this script .
science_man_88 is offline   Reply With Quote
Old 2010-12-17, 22:49   #2101
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

597910 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
I'm talking
Code:
default(primelimit,x)
seems faster than this script .
Wow, that was random.

Sure. So is the program
Code:
1
CRGreathouse is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

All times are UTC. The time now is 22:31.


Fri Aug 6 22:31:28 UTC 2021 up 14 days, 17 hrs, 1 user, load averages: 3.46, 3.33, 3.24

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.