Question about selection of a in the P1 algorithm
From [URL]https://www.mersenne.org/various/math.php[/URL]
[QUOTE] The P1 method is quite simple. In stage 1 we pick a bound B1. P1 factoring will find the factor q as long as all factors of k are less than B1 (k is called B1smooth). We compute E – the product of all primes less than B1. Then we compute x = 3[SUP]E*2*P[/SUP]. Finally, we check the GCD (x1, 2[SUP]P[/SUP]1) to see if a factor was found. [/QUOTE]When computing x, why are we taking 3[SUP]E*2*P[/SUP] instead of 2[SUP]E*2*P[/SUP]? Wouldn't any coprime number do? If so, why not choose the smaller one? 
The reason: 2^(E*2*p)==1 mod 2^p1.

[QUOTE=ZFR;566179]From [URL]https://www.mersenne.org/various/math.php[/URL]
When computing x, why are we taking 3[SUP]E*2*P[/SUP] instead of 2[SUP]E*2*P[/SUP]? Wouldn't any coprime number do? If so, why not choose the smaller one?[/QUOTE] E is not just the product of the primes < B1, it's the product of maximum integral powers of each prime fitting < B1 individually, called powersmooth. The exponentiation [B]a[/B][SUP]E*2*p[/SUP] is done mod Mp. So smaller [B]a[/B] 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. [URL="https://en.wikipedia.org/wiki/Pollard%27s_p_%E2%88%92_1_algorithm"]https://en.wikipedia.org/wiki/Pollard%27s_p_%E2%88%92_1_algorithm[/URL] As to why not 2 instead of 3, there's a smallnumbers example early in [URL]https://magazine.odroid.com/article/primenumberdiscoveryuseodroidc2makemathematicalhistory/[/URL] Later on, this same source includes, also in the context of primality testing, rather than P1 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 base2 pseudoprimes, irrespective of whether they are prime or composite. The two bestknown such classes are, firstly, the Mersenne numbers M(p) = 2[SUP]p[/SUP]−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, 2[SUP]11[/SUP]−1 passes the test even though it factors as 23 × 89. The second class of such numbers is the Fermat numbers[/CODE] 
[QUOTE=kriesel;566200] the product of maximum integral powers of each prime fitting < B1 individually[/QUOTE]
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. 
Ah, OK. So for base a=2 we'll have pseudoprimes only because 2^(E*2*p) is always 1 mod 2^p1
Thanks, everyone. Thanks for the article link, kriesel. 
[QUOTE=LaurV;566239]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.[/QUOTE]Instead of criticizing from the stands, try entering the arena. "It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming; but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat."
[url]https://www.mentalfloss.com/article/63389/rooseveltsmanarena[/url] 
@OP: Suggest you try a tiny M(p) example: n = M(11) = 2^111 = 23*89. The 2 prime factors have p1 decompositions:
p = 23: p1 = 2*11 q = 89: q1 = 2^3*11 So taking E = 2*11 in p1 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. 
[QUOTE=kriesel;566313]Instead of criticizing from the stands, try entering the arena. "It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming; but who does actually strive to do the deeds; who knows great enthusiasms, the great devotions; who spends himself in a worthy cause; who at the best knows in the end the triumph of high achievement, and who at the worst, if he fails, at least fails while daring greatly, so that his place shall never be with those cold and timid souls who neither know victory nor defeat."
[url]https://www.mentalfloss.com/article/63389/rooseveltsmanarena[/url][/QUOTE] Please don't overreact. AFAICS, LaurV's comment talked about no _person_ at all and I believe having opinions about _ideas_ is always fine. 
[QUOTE=ewmayer;566325]@OP: Suggest you try a tiny M(p) example: n = M(11) = 2^111 = 23*89. The 2 prime factors have p1 decompositions:
p = 23: p1 = 2*11 q = 89: q1 = 2^3*11 So taking E = 2*11 in p1 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.[/QUOTE] Thanks. 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^p1. imply that gcd(2^(E*2*p)1, 2^p1) = 2^p 1 
[QUOTE=ZFR;566363]How does
2^(E*2*p)==1 mod 2^p1. imply that gcd(2^(E*2*p)1, 2^p1) = 2^p 1[/QUOTE] 2^(E*2*p)==1 mod 2^p1 ==> 2^(E*2*p)1 == 0 mod 2^p1 Therefore gcd(2^(E*2*p)1, 2^p1) = gcd(0, 2^p1) = 2^p1 
[QUOTE=axn;566364]2^(E*2*p)==1 mod 2^p1
==> 2^(E*2*p)1 == 0 mod 2^p1 Therefore gcd(2^(E*2*p)1, 2^p1) = gcd(0, 2^p1) = 2^p1[/QUOTE] OK, thanks for explaining. Yeah, it's pretty basic, I can be blind at times. One last question: when Prime95 does the P1 algorithm, that timeconsuming part of it would be the exponentiation of 3 (and modulo n)? The gcd itself is pretty fast comparatively, right? 
All times are UTC. The time now is 13:54. 
Powered by vBulletin® Version 3.8.11
Copyright ©2000  2021, Jelsoft Enterprises Ltd.