mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2021-02-11, 11:57   #12
dcheuk
 
dcheuk's Avatar
 
Jan 2019
Tallahassee, FL

24310 Posts
Default

Quote:
Originally Posted by mattprim View Post
Mathematica has the native prime Number Theory routines: PrimeQ, NextPrime, PrimePi etc. Just was mainly curious how PrimeQ[2^n-1] giving the answer if 2^n-1 is prime. You can actually link stuff like PariGP to Mathematica using Mathlink so you can include own faster routines for Mersenne.
For science I picked 3 small M_p, of which one is prime, and run it with Mathematica and Prime95 with LL.

Unsurprising, Prime95 is exponentially faster since it is optimized to specifically test M_p for primality.

Click image for larger version

Name:	Capture.PNG
Views:	71
Size:	55.2 KB
ID:	24292Click image for larger version

Name:	Capture2.PNG
Views:	72
Size:	76.3 KB
ID:	24293
dcheuk is offline   Reply With Quote
Old 2021-02-11, 23:56   #13
mattprim
 
mattprim's Avatar
 
Feb 2021
Salt Lake City, UT

29 Posts
Default

Lucas-Lehmer test in native Mathematica:

p = 2976221;
s = 4;
Mp = 2^p - 1;
Do[s = Mod[(s*s - 2) , Mp];
If[s == 0, Print["PRIME"]], {i, 0, p - 2}];

puts me in top prime guys fast at least in 60-ties (below GHz*Day).

Last fiddled with by mattprim on 2021-02-12 at 00:14
mattprim is offline   Reply With Quote
Old 2021-02-12, 01:01   #14
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

22×23×107 Posts
Default

Quote:
Originally Posted by mattprim View Post
p = 2976221;
That is 30 times smaller than the current wave front.
It got double checked more than 20 years ago.

Quote:
puts me in top prime guys fast at least in 60-ties (below GHz*Day).
Top prime guys? What do you mean by that statement?
Uncwilly is online now   Reply With Quote
Old 2021-02-12, 02:29   #15
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

26×151 Posts
Default

Quote:
Originally Posted by Uncwilly View Post
Top prime guys? What do you mean by that statement?
He means the year. His test is as fast as some supercomputer ~55 years ago . Albeit I have to admit I don't know how to pronounce the the thing he wrote... sixty ties? sixty tits?

Last fiddled with by LaurV on 2021-02-12 at 02:32
LaurV is offline   Reply With Quote
Old 2021-02-12, 02:39   #16
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

26×151 Posts
Default

Quote:
Originally Posted by mattprim View Post
Lucas-Lehmer test in native Mathematica:

p = 2976221;
s = 4;
Mp = 2^p - 1;
Do[s = Mod[(s*s - 2) , Mp];
If[s == 0, Print["PRIME"]], {i, 0, p - 2}];

puts me in top prime guys fast at least in 60-ties (below GHz*Day).
Can you prove this test is correct? I mean, [excluding the fact that you could make it much faster by skipping the initialization (see the syntax of the "do" in Wolfram), and by taking the "if" out of the loop], can you prove that for some composite, you don't hit zero on the way? Can you prove? The "do" will execute the "if" test at every iteration, and if it displays "prime" you will have no idea after how many iterations it did that. You may have a composite that runs into the following residue chain: r0, r1, r2, .... rN, 0, -2 (mod Mp), 2, 2, 2, 2, 2, ..., this will still display "prime", for any N smaller than p-2.
Homework: prove this is not possible.

Last fiddled with by LaurV on 2021-02-12 at 02:47
LaurV is offline   Reply With Quote
Old 2021-02-12, 09:25   #17
mattprim
 
mattprim's Avatar
 
Feb 2021
Salt Lake City, UT

2910 Posts
Default

Quote:
Originally Posted by mattprim View Post
Lucas-Lehmer test in native Mathematica:

p = 2976221;
s = 4;
Mp = 2^p - 1;
Do[s = Mod[(s*s - 2) , Mp];
If[s == 0, Print["PRIME"]], {i, 0, p - 2}];

puts me in top prime guys fast at least in 60-ties (below GHz*Day).
While PariGP in 70-ties ?: LL(p)={
my(m=Mod(4,1<<p-1));
for(i=3,p,m=m^2-2);
m==0
};
?
? search()={
print("2^2-1");
forprime(p=3,43112609,
if(LL(p), print("2^"p"-1"))
)
};

? search()
2^2-1
2^3-1
2^5-1
2^7-1
2^13-1
2^17-1
2^19-1
2^31-1
2^61-1
2^89-1
2^107-1
2^127-1
2^521-1
2^607-1
2^1279-1
2^2203-1
2^2281-1
2^3217-1
2^4253-1
2^4423-1
2^9689-1
2^9941-1
2^11213-1
2^19937-1
2^21701-1
2^23209-1

Last fiddled with by mattprim on 2021-02-12 at 09:27
mattprim is offline   Reply With Quote
Old 2021-02-12, 09:31   #18
mattprim
 
mattprim's Avatar
 
Feb 2021
Salt Lake City, UT

29 Posts
Default

Quote:
Originally Posted by LaurV View Post
Can you prove this test is correct? I mean, [excluding the fact that you could make it much faster by skipping the initialization (see the syntax of the "do" in Wolfram), and by taking the "if" out of the loop], can you prove that for some composite, you don't hit zero on the way? Can you prove? The "do" will execute the "if" test at every iteration, and if it displays "prime" you will have no idea after how many iterations it did that. You may have a composite that runs into the following residue chain: r0, r1, r2, .... rN, 0, -2 (mod Mp), 2, 2, 2, 2, 2, ..., this will still display "prime", for any N smaller than p-2.
Homework: prove this is not possible.
Here is the proof of LL https://rosettacode.org/wiki/Lucas-Lehmer_test test https://planetmath.org/proofoflucaslehmerprimalitytest . It's kind of tricky because it kicks out of the integer space to irrational roots even if all stays in integer space and is a sort of expanded Little Fermat Theorem https://planetmath.org/inductiveproo...letheoremproof (s_i's with s_(n-2) divisible by M_n if and only if it is the prime are generating quasi-binomial in x=4=2^2 but more complicated). While s_i's are growing giant fast Prime95 for example is using the FFT multiplication of giant integers: http://numbers.computation.free.fr/C...ithms/fft.html using the "electronics signal" fact that the Fourier transform of the convolution f*g is the product of the transforms of two functions.

Last fiddled with by mattprim on 2021-02-12 at 10:17
mattprim is offline   Reply With Quote
Old 2021-02-12, 17:05   #19
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

26·5·17 Posts
Default

Mods: relocate thread to Misc Math?

Last fiddled with by kriesel on 2021-02-12 at 17:05
kriesel is online now   Reply With Quote
Old 2021-02-12, 17:11   #20
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

22×23×107 Posts
Default

Quote:
Originally Posted by kriesel View Post
Mods: relocate thread to Misc Math?
Why? Is the math bad? Is this not about using different software to confirm MP's?
Uncwilly is online now   Reply With Quote
Old 2021-02-12, 17:19   #21
dcheuk
 
dcheuk's Avatar
 
Jan 2019
Tallahassee, FL

35 Posts
Default

Quote:
Originally Posted by mattprim View Post
Here is the proof of LL https://rosettacode.org/wiki/Lucas-Lehmer_test test https://planetmath.org/proofoflucaslehmerprimalitytest . It's kind of tricky because it kicks out of the integer space to irrational roots even if all stays in integer space and is a sort of expanded Little Fermat Theorem https://planetmath.org/inductiveproo...letheoremproof (s_i's with s_(n-2) divisible by M_n if and only if it is the prime are generating quasi-binomial in x=4=2^2 but more complicated). While s_i's are growing giant fast Prime95 for example is using the FFT multiplication of giant integers: http://numbers.computation.free.fr/C...ithms/fft.html using the "electronics signal" fact that the Fourier transform of the convolution f*g is the product of the transforms of two functions.
I don’t think that’s what LaurV is getting at

Also Fermats littles theorem could be proven using Lagrange in one sentence. And what the heck is integer space to irrational roots you mean extension fields?

It’s not necessary to tell people here how Prime95 works.. what have we done to deserve this?
dcheuk is offline   Reply With Quote
Old 2021-02-12, 19:45   #22
mattprim
 
mattprim's Avatar
 
Feb 2021
Salt Lake City, UT

358 Posts
Default

Also PariGP LL test for n=41766037 https://www.mersenne.ca/exponent/41766037 on above 1GHz Machine some 12 seconds per step at 240-th step and slowing down. Extimated check time 5800 days above 10 years so native Mathematica above 100 years.

? default(parisize,"64M")
*** Warning: new stack size = 64000000 (61.035 Mbytes).
? LL(p)={
my(m=Mod(4,1<<p-1));print(p);
for(i=3,p,m=m^2-2;print(i));
m==0
};
?
? search()={
print("2^2-1");
p=41766037;
if(LL(p), print("2^"p"-1")
)
};
? search()
2^2-1
41766037
3
4
5
6
.
.
.
239
240

Last fiddled with by mattprim on 2021-02-12 at 20:18
mattprim is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching for m. primes is like playing lottery joblack Lounge 20 2009-01-05 15:18
to be faster at searching mersenne primes flosculus Information & Answers 6 2008-11-10 18:59
searching for Mersenne primes davieddy Math 7 2007-08-21 04:51
A Proposal for searching Recurrence Series Primes Erasmus Factoring 3 2004-05-14 09:26
Need help with math problem re: searching for all primes. daxm Miscellaneous Math 5 2003-07-20 19:32

All times are UTC. The time now is 23:19.


Fri Aug 6 23:19:15 UTC 2021 up 14 days, 17:48, 1 user, load averages: 4.19, 4.08, 4.04

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.