![]() |
![]() |
#1 | |
Feb 2008
Bray, Ireland
11·13 Posts |
![]()
From https://www.mersenne.org/various/math.php
Quote:
Wouldn't any coprime number do? If so, why not choose the smaller one? Last fiddled with by ZFR on 2020-12-14 at 21:13 |
|
![]() |
![]() |
#2 |
"Robert Gerbicz"
Oct 2005
Hungary
31×47 Posts |
![]()
The reason: 2^(E*2*p)==1 mod 2^p-1.
|
![]() |
![]() |
#3 | |
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest
29×173 Posts |
![]() Quote:
The exponentiation aE*2*p is done mod Mp. So smaller a doesn't really save run time, or operand size after relatively few operations. In practice the exponentiation is done with a full length fft transform from the start, so it saves no run time to use a smaller base. https://en.wikipedia.org/wiki/Pollar...92_1_algorithm As to why not 2 instead of 3, there's a small-numbers example early in https://magazine.odroid.com/article/...tical-history/ Later on, this same source includes, also in the context of primality testing, rather than P-1 factoring, the following: Code:
In the more general context of testing numbers of arbitrary size, however, it is important to realize that there are certain classes of numbers, all of which are Fermat base-2 pseudoprimes, irrespective of whether they are prime or composite. The two best-known such classes are, firstly, the Mersenne numbers M(p) = 2p−1 (for which we restrict the definition to prime exponents since that is required for a number of this form to have a chance of being prime); for example, 211−1 passes the test even though it factors as 23 × 89. The second class of such numbers is the Fermat numbers Last fiddled with by kriesel on 2020-12-15 at 01:35 |
|
![]() |
![]() |
#4 |
Romulan Interpreter
Jun 2011
Thailand
249916 Posts |
![]()
Haha, so complicate said. E is the LCM(x such as x<=B1). The "power trick" just happens to be the fastest known way to calculate it.
Last fiddled with by LaurV on 2020-12-15 at 08:45 |
![]() |
![]() |
#5 |
Feb 2008
Bray, Ireland
8F16 Posts |
![]()
Ah, OK. So for base a=2 we'll have pseudoprimes only because 2^(E*2*p) is always 1 mod 2^p-1
Thanks, everyone. Thanks for the article link, kriesel. |
![]() |
![]() |
#6 | |
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest
29×173 Posts |
![]() Quote:
https://www.mentalfloss.com/article/...elts-man-arena |
|
![]() |
![]() |
#7 |
∂2ω=0
Sep 2002
República de California
1162510 Posts |
![]()
@OP: Suggest you try a tiny M(p) example: n = M(11) = 2^11-1 = 23*89. The 2 prime factors have p-1 decompositions:
p = 23: p-1 = 2*11 q = 89: q-1 = 2^3*11 So taking E = 2*11 in p-1 stage 1 should turn up the smaller factor, i.e. in this case we don't even need any of the other smaller primes, just the 2*p bit, in E. Try it to the 2 bases in question and see what happens. Last fiddled with by ewmayer on 2020-12-15 at 23:54 Reason: Used onmodded-E in my first go - revised as exercise. |
![]() |
![]() |
#8 | |
Feb 2012
Prague, Czech Republ
2·5·17 Posts |
![]() Quote:
I believe having opinions about _ideas_ is always fine. |
|
![]() |
![]() |
#9 | |
Feb 2008
Bray, Ireland
2178 Posts |
![]() Quote:
gcd(4194303, 2047) = 2047 gcd(31381059608, 2047) = 23 So using base 2 gives us n, while using base 3 gives us the right answer. I played around with some other Mersenne numbers. The gcd always returns n. I might be overlooking something very obvious here, but I'm still missing one step. How does 2^(E*2*p)==1 mod 2^p-1. imply that gcd(2^(E*2*p)-1, 2^p-1) = 2^p -1 Last fiddled with by ZFR on 2020-12-16 at 10:35 |
|
![]() |
![]() |
#10 |
Jun 2003
2·3·19·43 Posts |
![]() |
![]() |
![]() |
#11 | |
Feb 2008
Bray, Ireland
11·13 Posts |
![]() Quote:
One last question: when Prime95 does the P-1 algorithm, that time-consuming part of it would be the exponentiation of 3 (and modulo n)? The gcd itself is pretty fast comparatively, right? |
|
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Sin/cos algorithm question #2 | Prime95 | Programming | 6 | 2020-07-15 06:09 |
Karatsuba algorithm relation to Matrix Multiplication (Strassen Algorithm)? | neomacdev | Computer Science & Computational Number Theory | 1 | 2019-07-30 01:40 |
Polynomial selection stage question | rawbinary | Msieve | 12 | 2010-08-02 23:41 |
Any ideas on v26 FFT selection algorithm? | Prime95 | Software | 20 | 2010-06-25 23:35 |
Motherboard Selection Help | jugbugs | Hardware | 13 | 2004-06-04 15:59 |