mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Math

Reply
 
Thread Tools
Old 2003-02-27, 13:20   #23
Tony Reix
 
Oct 2002

3310 Posts
Default Philmoore's algorithm with GP/Pari.

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
Tony Reix is offline   Reply With Quote
Reply



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

All times are UTC. The time now is 17:44.


Fri Jul 16 17:44:59 UTC 2021 up 49 days, 15:32, 1 user, load averages: 1.47, 1.46, 1.48

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.