20101214, 18:07  #144 
Oct 2007
Manchester, UK
2475_{8} Posts 
Ah, I snagged the stable binary for windows, I guess there's only a 32 bit version for that.
I would quite like a forbigprime loop. Are you saying then that while 64bit pari can generate more primes, you can't use them in a regular forprime loop? Incidentally, do you know why the limit is 4,294,965,247 and not 4,294,967,295? Those last 93 primes before 2^321 could be vitally important! 
20101214, 19:54  #145  
Aug 2006
2×29×103 Posts 
Quote:
Quote:
But it would often be convenient to loop over more primes than you can fit in memory. For example, there's no way I could fit the primes to 10^12 in memory, but I'd like to check the conjecture up to that point. The implementation leaves free space of about 2000, as I recall, so there is room for status and whatnot in the word. 

20101214, 20:11  #146 
Aug 2006
2×29×103 Posts 
Likewise  I wanted one enough that I sat down and wrote one. But there are still fencepost errors, and also a few things I'd like to optimize before I send it out.
The version I have right now is reasonably efficient for long intervals (forprime(p=a,b, ...) with b  a >> sqrt(b) or so) but inefficient for small intervals. It would be very easy to write a function to handle short intervals (sieve out tiny primes then test with ispseudoprime), so I might break the code into four parts: forprime forbigprime forsmallprime forthinprime where the existing forprime would move to forsmallprime, the new code would go into forbigprime (and maybe also new code in forbigprime_word*), forthinprime would be the neartrivial code for handling short intervals, and forprime would handle errors and decide which function to use. I don't think these would be exposed to GP; it would probably be best to let users remain ignorant of the different workings. There are some sticking points, though. First, it's usually good to warn the user if they try to exceed primelimit. If you want to loop over the primes up to 100 million, just calculate those primes, don't use forbigprime (which, by its nature, will be slower) and then throw them away! Second, forprime currently allows code like Code:
forprime(p=2,100,print1(p" ");if(p==3,p=80)) One possibility would be to use a different function ("forbigprime") in GP, so users only use the appropriate function. This takes care of the above issues, but exposes more complexity to the user than is desirable. Another would be to allow the index to change with forbigprime, but if it does just kick them into forthinprime. Another would be to disallow changing the index entirely. * which would handle cases where the upper limit is larger than primelimit but not larger than a word  2^321 or 2^641 on 32 and 64bit, respectively. 
20101214, 21:00  #147 
Oct 2007
Manchester, UK
3^{2}·149 Posts 
This program is for use (ideally) by people who already know what they're doing, I don't see why these specific loops would need to be hidden. On a personal note, I would prefer knowing what code is going to do when I run it, rather than be unsure because I don't happen to know the current primelimit.
It would be possible to get the best of both worlds though, have a generic loop that can call whichever loop seems most appropriate, and the numerous specific loops for people who already know what they want, it only takes a few lines in the documentation. If there's no way (or it is at least very hard) to make the forbigprime loop efficient AND able to jump around with the index, then it seems reasonable to deny the ability to change it, for that loop only. 
20101214, 21:04  #148  
"Forget I exist"
Jul 2009
Dumbassville
2^{6}×131 Posts 
Quote:


20101214, 21:20  #149 
Oct 2007
Manchester, UK
3^{2}·149 Posts 
Well, not exactly, but sort of:
http://primes.utm.edu/notes/gaps.html Trivia: this is where god lives. 
20101214, 21:37  #150  
"Forget I exist"
Jul 2009
Dumbassville
2^{6}·131 Posts 
Quote:


20101214, 21:48  #151 
"Forget I exist"
Jul 2009
Dumbassville
2^{6}×131 Posts 
given primes p and q<p we can show that the composites ruled out are q%((p^2q^2)%q) mod q above p^2. but i can't take this any further.

20101214, 21:49  #152 
Oct 2007
Manchester, UK
3^{2}·149 Posts 
Perhaps this then:
http://www.ieeta.pt/~tos/gaps.html While you're at it could you explain what this means: 
20101214, 21:52  #153  
"Forget I exist"
Jul 2009
Dumbassville
2^{6}·131 Posts 
Quote:
Last fiddled with by science_man_88 on 20101214 at 21:54 

20101214, 21:54  #154 
"Forget I exist"
Jul 2009
Dumbassville
2^{6}×131 Posts 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Regarding Squares  a1call  Miscellaneous Math  42  20170203 01:29 
Basic Number Theory 12: sums of two squares  Nick  Number Theory Discussion Group  0  20161211 11:30 
Integers = sums of 2s and 3s.  3.14159  Miscellaneous Math  12  20100721 11:47 
Sums of three squares  CRGreathouse  Math  6  20091106 19:20 
squares or not squares  m_f_h  Puzzles  45  20070615 17:46 