![]() |
|
|
#23 |
|
Oct 2002
3310 Posts |
Here is the GP code for Philmoore's algorithm (for Mersenne primes), tested with gp v 2.1.1 .
It's quite slow! (I'm not using GMP kernel). [code:1] tony(q) = { p=2^q-1; b=3^(2^(q-2)) % p; if(2*b>p,b=p-b); a=p; s=floor(sqrt(p)); while(b>s,t=a % b; a=b; b=t); x=b; y=floor(sqrt((p-x^2)/3)); print("Mq= ",p); print("x= ",x); print("y= ",y); print("x^2+3y^2= ",x^2+3*y^2); } [/code:1] How to use: ? tony(19) Mq= 524287 x= 298 y= 381 x^2+3y^2= 524287 |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| (M48) NEW MERSENNE PRIME! LARGEST PRIME NUMBER DISCOVERED! | dabaichi | News | 571 | 2020-10-26 11:02 |
| Twin Prime Days, Prime Day Clusters | cuBerBruce | Puzzles | 3 | 2014-12-01 18:15 |
| disk died, prime work lost forever? where to put prime? on SSD or HDD? | emily | PrimeNet | 3 | 2013-03-01 05:49 |
| Prime Cullen Prime, Rest in Peace | hhh | Prime Cullen Prime | 4 | 2007-09-21 16:34 |
| The 40th known Mersenne prime, 220996011-1 is not PRIME! | illman-q | Miscellaneous Math | 33 | 2004-09-19 05:02 |