mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Miscellaneous Math

Reply
 
Thread Tools
Old 2014-04-13, 22:02   #12
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

164448 Posts
Default

Quote:
Originally Posted by ewmayer View Post
I have not - any elementary NT text discusses these kinds of tests, which date back to Fermat himself.


The -2 is an utterly trivially time component of an LL test.
Note also that for each of p-1 steps in LL it is "square then subtract a
single precision constant".

Computing 3^(N-1) requires a squaring for each bit in the exponent (as does LL), BUT ALSO additional multiplications depending on how one does the
exponentiation. (simple left to right requires one additional mult for each
lit bit; the binary/trinary method or sliding windows require somewhat less,
but still require additional multiplications)

It wil be SLOWER.

The OP is an idiot.
R.D. Silverman is offline   Reply With Quote
Old 2014-04-13, 22:17   #13
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Okay this follows from Fermat's little theorem.



so we are testing 3^{2^{p-1}} here ? if 3^{2^{p-1}} = -3 mod M then we can say 3^{2^{p-1}-1} = -1 mod M, and 3^{2^{p}-2} is 1 mod M, and 3^{2^{p}-1} = 3 mod M no ? can you explain this more. (I really can't say I'm correct as I'm trying to use Fermat's little theorem as well recently, yet didn't read the part talking about Lehmer's theorem in relation to the LL test., and of course as mentioned it's almost positive to have come up before.)
Doh! I realize my mistake now.
science_man_88 is offline   Reply With Quote
Old 2014-04-13, 23:33   #14
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

103·113 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
Computing 3^(N-1) requires a squaring for each bit in the exponent (as does LL), BUT ALSO additional multiplications depending on how one does the
exponentiation. (simple left to right requires one additional mult for each
lit bit;
Thanks for the clarification - I had in mind the special case of Fermat numbers, where lit-bits-beyond-the-leftmost-one in N-1 (and (N-1)/2) are somewhat scarce. :)
ewmayer is offline   Reply With Quote
Old 2014-04-14, 01:15   #15
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

2·7·677 Posts
Default

Berrizbeitia-Iskra (2010) demonstrates another case of a Pépin-like proven strategy (see theorem 3.4, parts 1 and 2).
@OP: They didn't just say: "we've tested it on all known G-M and E-M primes and there were no contra cases, so it must be true". They proved a theorem.
Batalov is offline   Reply With Quote
Old 2014-04-14, 04:08   #16
kladner
 
kladner's Avatar
 
"Kieren"
Jul 2011
In My Own Galaxy!

2×3×1,693 Posts
Default


Nice show, gents!
kladner is offline   Reply With Quote
Old 2014-04-14, 06:10   #17
axn
 
axn's Avatar
 
Jun 2003

10011101111012 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
Computing 3^(N-1) requires a squaring for each bit in the exponent (as does LL), BUT ALSO additional multiplications depending on how one does the
exponentiation. (simple left to right requires one additional mult for each
lit bit; the binary/trinary method or sliding windows require somewhat less,
but still require additional multiplications)

It wil be SLOWER.
I think the OP realizes this -- hence his actual calculation uses 3^(N+1)/2 == -3 (mod N). which requires only repeated squarings

Quote:
Originally Posted by boldi View Post
From the congruence relation we can extract a recursive calculation algorithm if a Mersenne number is prime or not. (It is pretty similar to Lucas-Lehmer test, but a little bit simpler and faster)

I will show an example how it works: Let be p=7 a prime number and the Mersenne number is M_7 = 2^7-1 = 127. Now we want to proof, that M_7 is prim or not. So we are calculating recursive the sequence

S_n = S_(n-1) ∙ S_(n-1) mod M with S_0=3

The sequence will be calculated from n=1 to n=p-1, in our case from 1 to 6:

S_1 = 3∙3 mod 127=9
S_2 = 9∙9 mod 127=81
S_3 = 81∙81 mod 127=84
S_4 = 84∙84 mod 127=71
S_5 = 71∙71 mod 127=88
S_6 = 88∙88 mod 127=124

As result we have got 124. Now we are test, if 124 + S_0 = M_7. If yes, then M ist prime, if no, M is no prime. In our case we have 124 + 3 = 127 = M_7, so M_7 is prime.

Here the code in C:

bool MersennnePrimeTest(p)
{
Bigint n, M, S;

M = 2^p – 1;
S = 3;

for(n = 1, n <= p – 1, n++) S = S*S % M;

if(S + 3 == M) return(true); //M = prime;
else return(false); //M = not prime
}

This test is simpler and faster than the Lucas-Lehmer test, because we have no subtraction. (In Lucas-Lehmer-test we have to calculate the sequence S_n=S_(n-1)∙S_(n-1) - 2 mod M)
axn is offline   Reply With Quote
Old 2014-04-14, 11:42   #18
boldi
 
Apr 2014

2×7 Posts
Default

Quote:
Originally Posted by Batalov View Post
Berrizbeitia-Iskra (2010) demonstrates another case of a Pépin-like proven strategy (see theorem 3.4, parts 1 and 2).
@OP: They didn't just say: "we've tested it on all known G-M and E-M primes and there were no contra cases, so it must be true".

They proved a theorem.
Thank You for the link.

First of all: In my postings I have never said my conjecture must be true.

On the contrary: In my first post I have pointed out, the conjecture needs a strong mathematical proof.

And all I ask is: Is there a proof for the conjecture, that only Mersenne primes can pass the congruence

3^{M-1} \equiv  1 mod M

You tell me, they have proved a theorem -- thanks (I mean this seriosley), but where is this proof? In the paper You have linked I can see no answer for my question.

Greetings
boldi
boldi is offline   Reply With Quote
Old 2014-04-14, 14:42   #19
tapion64
 
Apr 2014

5×17 Posts
Default

Quote:
Originally Posted by boldi View Post
Thank You for the link.

First of all: In my postings I have never said my conjecture must be true.

On the contrary: In my first post I have pointed out, the conjecture needs a strong mathematical proof.

And all I ask is: Is there a proof for the conjecture, that only Mersenne primes can pass the congruence

3^{M-1} \equiv  1 mod M

You tell me, they have proved a theorem -- thanks (I mean this seriosley), but where is this proof? In the paper You have linked I can see no answer for my question.

Greetings
boldi
I swear I've seen that conjecture somewhere on the multitude of sites I've been looking at over the past week, but I can't seem to find it. I believe there's a link in one of the GIMPS section threads that mentions it. A similar test is Pepin's:

3^[(Fn-1)/2] = (-1) mod Fn

For Fermat numbers. It seems reasonable that someone conjectured an analogue for Mersenne primes, I just can't find it at the moment. Actually, square both sides of the above and you get 3^(Fn-1) = 1 mod Fn, so maybe you had it mixed up that the conjecture was for Mersenne primes. Clearly if it holds for Fermat numbers, then it doesn't just hold for Mersenne primes.

Last fiddled with by tapion64 on 2014-04-14 at 14:59
tapion64 is offline   Reply With Quote
Old 2014-04-14, 15:56   #20
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

11101001001002 Posts
Default

Quote:
Originally Posted by ewmayer View Post
Thanks for the clarification - I had in mind the special case of Fermat numbers, where lit-bits-beyond-the-leftmost-one in N-1 (and (N-1)/2) are somewhat scarce. :)
It is also unclear whether one could use Crandall's DWFT owing to the
extra multiplications by 3 that need to take place in computing 3^(N-1).

It is also unclear whether one gets the remainder "for free" as we do with
LL/DWFT.
R.D. Silverman is offline   Reply With Quote
Old 2014-04-14, 16:00   #21
R.D. Silverman
 
R.D. Silverman's Avatar
 
Nov 2003

746010 Posts
Default

Quote:
Originally Posted by boldi View Post
And all I ask is: Is there a proof for the conjecture, that only Mersenne primes can pass the congruence

3^{M-1} \equiv  1 mod M

You tell me, they have proved a theorem -- thanks (I mean this seriosley), but where is this proof? In the paper You have linked I can see no answer for my question.
Please convey some supporting heuristical/probabilistic arguments as
to why the conjecture SHOULD be true. It is known that every base
is a false witness to infinitely many integers. The question here is
why 3 should be different and why it should not be a false witness to
Mersenne numbers.

I see no reason for it to be true other than that it works for a very small
set of examples.
R.D. Silverman is offline   Reply With Quote
Old 2014-04-14, 16:31   #22
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

Quote:
Originally Posted by R.D. Silverman View Post
I see no reason for it to be true other than that it works for a very small
set of examples.
I'm guessing you car more for what the OP thinks ?

My mistake in post 9 is that I took it too far I'll start edit: "I think" with that

Last fiddled with by science_man_88 on 2014-04-14 at 16:35
science_man_88 is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fastest software for Mersenne primality test? JonathanM Information & Answers 25 2020-06-16 02:47
New Mersenne primality test Prime95 Miscellaneous Math 19 2014-08-23 04:18
LLT Cycles for Mersenne primality test: a draft T.Rex Math 1 2010-01-03 11:34
Mersenne Primality Test in Hardware Unregistered Information & Answers 4 2007-07-09 00:32
A primality test for Fermat numbers faster than Pépin's test ? T.Rex Math 0 2004-10-26 21:37

All times are UTC. The time now is 11:54.


Sat Jul 17 11:54:04 UTC 2021 up 50 days, 9:41, 1 user, load averages: 1.03, 1.25, 1.27

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.