![]() |
|
|
#23 | |
|
Apr 2014
2·7 Posts |
Quote:
I will keep this in mind. Greetings boldi |
|
|
|
|
|
|
#24 |
|
Nov 2003
22×5×373 Posts |
|
|
|
|
|
|
#25 | |
|
Apr 2014
2×7 Posts |
Quote:
Please give me a little time, You will get the answer. First I have to show a proof for something other. I think, You know what I mean. ;-) Greetings boldi Last fiddled with by boldi on 2014-04-14 at 17:00 |
|
|
|
|
|
|
#26 |
|
Apr 2014
2×7 Posts |
Hi folks,
as I have said, if the conjecture holds, it leads to a faster Mersenne prime test. So it is worth to think about it. Here I give the proof that the algorithm I have shown, is faster than the Lucas-Lehmer test. We take a number-cruncher like Pari/GP from http://pari.math.u-bordeaux.fr/ and write down 2 routines: /*---------------------------------------------------------- Lucas Lehmer Test ------------------------------------------------------------*/ LucasLehmerTest(p)={ local(M, s, i); M = 1<<p - 1; s = 4; for(i=2, p-1, s = Mod(s*s - 2, M)); if(s == 0, print(p, " prime"), print(p, " no prime")); } /*------------------------------------------------------------ New Mersenne Test --------------------------------------------------------------*/ NewMersenneTest(p)={ local(M, b, i); M = 1<<p - 1; b = 3; for(i=1, p-1, b = Mod(b*b, M)); if (b+3 == M, print(p, " prime"), print(p, " no prime")); } /*------------------------------------------------------------*/ As You can see, both routines ar written similar. Running a test I have got follow results: LucasLehmerTest(132049) needs 11min, 41,686ms NewMersenneTest(132049) needs 11min, 37,448ms So the new test is 4,2 sec faster. But the next thing is, I have never told, that the recursive algorithm is the best way, to calculate the congruence. I have shown it only as an example to point out, that the congruence leads at least to an algorithm, wich is similar and simple as LL. The best way for calculating the congruence is, to find a fast modular exponentiation. (It would be great, if we could discuse this topic here.) For the moment I show the difference between best programmed Lucas Lehmer test and best programmed new Mersenne test with modular exponentiation in Pari. We write down 2 routines: The fastest way to implement Lucas Lehmer and the new Mersenne test on Pari/GP is the following code: /*---------------------------------------------------------- Lucas Lehmer test as fast as possible in Pari/GP ------------------------------------------------------------*/ LucasLehmerFast(p)={ local(s,n); my(s = Mod(4, 1<<p-1)); for(n = 3, p, s = s^2 - 2); if (s == 0, print(p, " prime"), print(p, " no prime")); } /*---------------------------------------------------------- New Mersenne test as fast as possible in Pari/GP ------------------------------------------------------------*/ NewMersenneFast(p) = { local(m, m1, m2, b); m = 1<<p - 1; m1 = m - 1; m2 = m1 / 2; b = lift(Mod(3, m)^m2); if (b == M1, print(p, " prime"), print(p, " no prime")); } /*------------------------------------------------------------*/ Running a test I have got the following results: LucasLehmerFast(132049) needs 11min, 39,555ms NewMersenneFast(132049) needs 10min, 29,338ms So the new test ist 1min 10 sec faster than Lucas Lehmer. In other words: If it needs 110 days with LL to check if the next big Mersenne is prime or not, with the new test it needs only 100 days. But please be aware: We are testing a lot of numbers, so in sum with the new test we could save a lot of time. As the member axn has correct pointed out, for this test I have not used the congruence As I have said, further optimizations are possible. There are several ways to write down the congruence. For the last test I have used the congruence Greetings boldi Last fiddled with by boldi on 2014-04-14 at 17:56 |
|
|
|
|
|
#27 | |
|
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
2×7×677 Posts |
Quote:
They have proved their theorem. I repeat: their theorem. "Your" "conjecture" is the converse of little Fermat and is known for centuries to be proven - that is, proven false. Did you get this? I repeat: proven false. |
|
|
|
|
|
|
#28 | ||
|
Nov 2003
22·5·373 Posts |
Quote:
facts that contradict that dogma, one tends to lose all credibility. Your test is NOT faster. It is slower. It requires MORE multi-precision multiplications. It is more work to perform multi-precision exponentiation with an exponent of length k when the exponent contains 1 bits (indeed; almost all bits are 1 for M_p) than it is to do k squarings. Quote:
become a good deal more intelligent to become a moron. (1) Your second piece of code does NOT COMPUTE 3^(N-1) mod N. (2) If you imagine that tiny run time differences in *interpreted* code with "similar" code proves one method is better, then you truly are not only a moron, you are an imbecile studying to be a moron. This is especially true when one of the pieces of code DOES NOT COMPUTE WHAT YOU CLAIM. <rest of nonsense deleted> I bring back my old signature. It is relevant here. "You can lead a horse's ass to knowledge, but you can't make him think" |
||
|
|
|
|
|
#29 | |
|
Apr 2014
5×17 Posts |
Quote:
Either way, he's stated that he's not using 3^(N-1) mod N, pay attention. |
|
|
|
|
|
|
#30 | |||||
|
Apr 2014
E16 Posts |
Quote:
Quote:
You should read more seriosley. Quote:
I surely I take the optimization. Quote:
But another question: Where is Your proof, that LL is faster? I have not seen any programm code from You. All I can read from You are claims. Quote:
Ok folks, I think, now I have earned a coffee break. See You later. Greetings boldi |
|||||
|
|
|
|
|
#31 | |
|
Sep 2002
Database er0rr
3,739 Posts |
Quote:
Last fiddled with by Batalov on 2014-04-14 at 18:51 Reason: (full quote makes difficult to read; shortened) |
|
|
|
|
|
|
#32 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Code:
? NewMersenneFast(p) = {
local(m, m1, m2, b);
m = 1<<p - 1;
m1 = m - 1;
m2 = m1 / 2;
b = lift(Mod(3, m)^m2);
if (b == M1, print(p, " prime"), print(p, " no prime"));
}
? NewMersenneFast(132049)
*** at top-level: NewMersenneFast(1320
*** ^--------------------
*** in function NewMersenneFast: ...1;m2=m1/2;b=lift(Mod(3,m)^m2);if(b==M1,print(
*** ^--------------------
*** _^_: user interrupt after 1min, 45,507 ms.
*** Break loop: type <Return> to continue; 'break' to go back to GP
break>
? NewMersenneFast(1061)
1061 no prime
? NewMersenneFast(7)
7 no prime
|
|
|
|
|
|
|
#33 |
|
Sep 2002
Database er0rr
3,739 Posts |
There is an error in the code as pari is case sensitive: m1 is not M1
Last fiddled with by paulunderwood on 2014-04-14 at 19:38 |
|
|
|
![]() |
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 |