mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Miscellaneous Math (https://www.mersenneforum.org/forumdisplay.php?f=56)
-   -   A (new) old, (faster) slower mersenne-(primality) PRP test (https://www.mersenneforum.org/showthread.php?t=19280)

boldi 2014-04-13 20:31

A (new) old, (faster) slower mersenne-(primality) PRP test
 
(First of all please excuse my bad English)

Conjecture: [I]Let p be a [B]odd[/B] prime number. Then the Mersenne number M = 2^p -1 holds the congruence relation[/I]

3^(M-1) ≡ 1 mod M

[I]if, and only if M is prime. (In comparison to little Fermat theorem there is no Mersenne-pseudoprime who can hold the congruence relation.)[/I]

This can be used as a Mersenne primality test. To proof, if a Mersenne number is prime, only check if it holds the congruence relation 3^(M-1) ≡ 1 mod M

Example:
p=7: 3^(127-1)-1 mod 127 = 1 --> prime
p=11: 3^(2047-1)-1 mod 2047 = 1013 --> not prime

I have tested it and it is valid for all Mersenne numbers M = 2^p-1 for p=2 to 23209. But what it needs is a strong mathematical proof.

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)

greetings
boldi

ewmayer 2014-04-13 20:52

If you think is either new (it isn't), or faster than LL (also false), or a rigorous test of primality (again, no), you are in dire need of a course (or reading-yourself) in elementary number theory.

Qubit 2014-04-13 20:56

[QUOTE=boldi;371070]Conjecture: [I]Let p be a prime number. Then the Mersenne number M = 2^p -1 holds the congruence relation[/I]

3^(M-1) ≡ 1 mod M

[I]if, and only if M is prime.[/I]

I have tested it and it is valid for all Mersenne numbers M = 2^p-1 for p=2 to 23209. But what it needs is a strong mathematical proof.[/QUOTE]

Perhaps I misunderstood, but for M = 3 we get 3^2 = 9, which is 0 mod 3.

tapion64 2014-04-13 21:01

[QUOTE=Qubit;371073]Perhaps I misunderstood, but for M = 3 we get 3^2 = 9, which is 0 mod 3.[/QUOTE]
That's because 3 is the only Mersenne prime index with an even multiplicative order mod 2, which in general just makes all these special rules not apply to it. I'll have to look into this.

Qubit 2014-04-13 21:02

edit: Whoops, miscalculation.

boldi 2014-04-13 21:09

[QUOTE=Qubit;371073]Perhaps I misunderstood, but for M = 3 we get 3^2 = 9, which is 0 mod 3.[/QUOTE]

Thank You for this statement. I have to specify the conjecture:

Conjecture: Let p be a [B]odd[/B] prime number. Then the Mersenne number M = 2^p -1 holds the congruence relation

3^(M-1) ≡ 1 mod M

if, and only if M is prime. (In comparison to little Fermat theorem there is no Mersenne-pseudoprime who can hold the congruence relation.)

Greetings
boldi

boldi 2014-04-13 21:17

[QUOTE=ewmayer;371072]If you think is either new (it isn't)[/QUOTE]

You have forgotten to name the paper, where this topic is discused.


[QUOTE] or faster than LL (also false),[/QUOTE]

If conjecture holds, it is faster, because there is no subtraction. Because there is no subtraction, further optimazions are possible. Programming my code and measure the time!


[QUOTE] or a rigorous test of primality (again, no), you are in dire need of a course (or reading-yourself) in elementary number theory.[/QUOTE]

If conjecture holds it is an rigorous test. Perhaps You need a course in quoting papers, all I can read from You are unprooven allegations.

greetings
boldi

ewmayer 2014-04-13 21:28

[QUOTE=boldi;371078]You have forgotten to name the paper, where this topic is discused.[/quote]
I have not - any elementary NT text discusses these kinds of tests, which date back to Fermat himself.

[quote]If conjecture holds, it is faster, because there is no subtraction. Because there is no subtraction, further optimazions are possible. Programming my code and measure the time![/quote]
The -2 is an utterly trivially time component of an LL test. I *have* programmed both kinds of tests (the test you describe differs from what *is* a rigorous primality test for Fermat numbers only by having one extra modmul), at a very high level of code sophistication, and regularly compare timings. You go program your own code and get back to us when you have results and code others can inspect.

[quote]If conjecture holds it is an rigorous test. Perhaps You need a course in quoting papers, all I can read from You are unprooven allegations.[/quote]
It is you making unproven - in fact long-since-disproven - "allegations".

And your blustery "how dare you question my brilliant insight?" reply just raised your crank score even higher. I suggest you learn at least a little bit of the relevant math and algorithmics before spouting off further.

(But you probably won't take the latter advice, which is OK, as that will serve for amusement.)

science_man_88 2014-04-13 21:44

[QUOTE=boldi;371070](First of all please excuse my bad English)

Conjecture: [I]Let p be a [B]odd[/B] prime number. Then the Mersenne number M = 2^p -1 holds the congruence relation[/I]

3^(M-1) ≡ 1 mod M

[/QUOTE]

Okay this follows from Fermat's little theorem.

[QUOTE]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.[/QUOTE]

so we are testing [TEX]3^{2^{p-1}}[/TEX] here ? if [TEX]3^{2^{p-1}}[/TEX] = -3 mod M then we can say [TEX]3^{2^{p-1}-1}[/TEX] = -1 mod M, and [TEX]3^{2^{p}-2}[/TEX] is 1 mod M, and [TEX]3^{2^{p}-1}[/TEX] = 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.)

Batalov 2014-04-13 21:47

Must be the springtime! Not just one, but two eloquent cranks, at once!

R.D. Silverman 2014-04-13 21:55

[QUOTE=boldi;371078]You have forgotten to name the paper, where this topic is discused.

[/QUOTE]

It has been discussed EXTENSIVELY in
so many places that it would be impossible to keep track.
It has been discussed numerous times in this forum.


[QUOTE]
If conjecture holds, it is faster, because there is no subtraction.
[/QUOTE]

HORSESHIT. Analyze the complexity.


[QUOTE]
Because there is no subtraction, further optimazions are possible. Programming my code and measure the time!

[/QUOTE]

A pointless exercise.



[QUOTE]
If conjecture holds it is an rigorous test.
[/QUOTE]

And there is no proof.

[QUOTE]
Perhaps You need a course in quoting papers, all I can read from You are unprooven allegations.

[/QUOTE]

You need a course in how to respect your elders and those possessing
superior education and knowledge. How many papers have YOU published
in this subject area?? Ernst is a acknowledged expert in this subject.
Go to any number theory conference and ask.

Now what have YOU done to earn respect?

You come across as an arrogant and ignorant ass.


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

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.