mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Math

Reply
 
Thread Tools
Old 2003-08-02, 09:33   #1
nucleon
 
nucleon's Avatar
 
Mar 2003
Melbourne

5·103 Posts
Default P-1 factoring in prime95

Guys,

I'm reading the math behind prime95 (i.e http://www.mersenne.org/math.htm)

And I'm having trouble understanding the P-1 factoring section. The P-1 link (http://www2.netdoor.com/~acurry/mersenne/archive1/0303.html) is now dead.

Espically I don't understand why do GCD (x-1, (2^P) - 1), where x = 3 ^(E*2*P), P is the P from (2^P) - 1, E is the product of all primes less than B1, and B1 is a suitable bound.

If anyone could point me to a url that explains to a bit more depth, I'd be appreciative. I know what the GCD algorithim is.

The questions in my head are - what range factors specifically does this check? Isn't 'x' from above extremely large to be any use in the GCD? Isn't x very time consuming to calculate?

Out of curiousity does anyone know the computational compexity on GCD(x,y)? For example is it proportional to greater of (log x, log y)?

Any ideas to the above appreciated.

-- Craig
nucleon is offline   Reply With Quote
Old 2003-08-02, 12:27   #2
apocalypse
 
Feb 2003

101011102 Posts
Default

To understand the P-1 algorithm, you first need Fermat's Little Theorem: if P is prime, a^(P-1) = 1 (mod P) if gcd(a, P) = 1.

To rewrite, a^(P-1) - 1 = c*P = 0 (mod P)
Hence a^(P-1) - 1 = c*P (mod k*P), let k*P = N, the number we want to factor.

Since we don't know P in advance, we only need a little more arithmetic to show:

a^(m*(P-1)) - 1 = d*P (mod N), let m*(P-1) = E, our product of small primes

So if P-1 divides the product of small primes in the exponent on the left side of the congruence, we will find it when we run GCD(a^(E) - 1, N)

For GIMPS, we use 2*p*E, because it is proven that all factors of Mp are of the form 2kp + 1.

To answer your specific questions:

1) P-1 does not so much test a "range" of factors as a set of factors with a certain quality. In this case, the quality is that the P-1 is the product of "small" numbers. Some of these primes can be very large, much larger than could be found through trial factoring.

2) The value 'x' does not have to be large because it can (and should) be computed modulo the number we are testing (2^p - 1)

3) The time required to compute 'x' depends on the bounds chosen. Multiplying a few thousand numbers together (modulo 2^p -1) is not nearly as time consuming as running a LL-test.

4) The Euclidean Algorithm requires O(lg(x) + lg(y)) steps because one the numbers is reduced by at least half in every iteration. If x and y are the same order of magnitude, the step can be run in O(lg(x) + lg(y)). Otherwise we need to do an integer division step which is more time consuming (O((lg n)^2)?)

For more information, the best general (short) introduction to computational factoring which I have found is "A Survey of Modern Integer Factorization Algorithms" by Montgomery (1994). It has a section on the P-1 algorithm.
apocalypse is offline   Reply With Quote
Old 2003-08-02, 14:11   #3
nucleon
 
nucleon's Avatar
 
Mar 2003
Melbourne

5×103 Posts
Default

Thanks, still going through it. Still don't understand how (2^P) - 1 fits into what you've said for P - 1 factoring. But thanks for the answers. I'll sleep on it for a while :)

How do I read .psl files from the link you posted?

-- Craig
nucleon is offline   Reply With Quote
Old 2003-08-02, 17:58   #4
apocalypse
 
Feb 2003

2×3×29 Posts
Default

I am using capital P to denote the factor and lowercase p to denote the Mersenne exponent. 2^p - 1 is simply the N we are trying to factor.

To wit: P = 2*k*p + 1

The file is actually a postscript file (should be .ps) If you do not have a postscript reader already, try downloading Ghostscript and GSview. I don't have links handy right now, but you should be able to find them with your favorite search engine.
apocalypse is offline   Reply With Quote
Old 2003-08-02, 23:55   #5
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

22·3·641 Posts
Default

Quote:
Originally Posted by nucleon
Still don't understand how (2^P) - 1 fits into what you've said for P - 1 factoring.
Quote:
Originally Posted by apocalypse
I am using capital P to denote the factor and lowercase p to denote the Mersenne exponent. 2^p - 1 is simply the N we are trying to factor.

To wit: P = 2*k*p + 1
Every explanation of the P-1 method to a newbie ought to start with something like "The 'P' in P-1 is not the same as the 'p' in 2^p - 1."
cheesehead is offline   Reply With Quote
Old 2003-08-03, 01:09   #6
nucleon
 
nucleon's Avatar
 
Mar 2003
Melbourne

5·103 Posts
Default

apoc - thanks.

Ghostview works fine. I'm still reading it at the moment, but my head is starting to hurt :)

Might have a break for a while and get back to it.

-- Craig
nucleon is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Speedup of trial factoring with prime95/mprime Anonuser Information & Answers 13 2014-09-09 01:43
P-1 factoring with Prime95 MatWur-S530113 Factoring 1 2007-09-22 02:53
Prime95 v24.14 P-1 Factoring problem harlee Software 1 2006-12-19 22:19
How do I interpret Prime95 factoring benchmarks? jasong Hardware 1 2006-10-23 12:08

All times are UTC. The time now is 17:47.


Fri Jul 16 17:47:21 UTC 2021 up 49 days, 15:34, 1 user, load averages: 1.78, 1.56, 1.51

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.