![]() |
![]() |
#12 |
Aug 2002
Buenos Aires, Argentina
3×5×97 Posts |
![]()
In the example given in the Wiki, only step 1 is done. Note that according to the last paragraph of the "Step 1" section, the exponent of the Mersenne number will divide p-1, so that exponent is included as well when computing the value E, so step 2 is not needed in this case.
|
![]() |
![]() |
![]() |
#13 | |
Romulan Interpreter
"name field"
Jun 2011
Thailand
37·271 Posts |
![]() Quote:
All this basic algorithms (including P-1) are very easy to understand assuming one knows basic algebra and Fermat's little theorem (FT). You do not need anything else (I do not mean you personally, I mean in general, and I am convinced that you personally know these facts much better than me and than anyone here!) . Basic algebra tells us that any poly of the form So the order of any x in any prime p is a factor of p-1. If you multiply two p's together to get n, then the order of x in n is LCM of the two orders, that turns out to be a factor of LCM(p1-1, p2-1). Now, for a mersenne number m, all factors are 2*k*p+1, so the order of any x in m is a factor of LCM(2*ki*p, for all i). This order is what P-1 tries to find, taking x=3. This number may contain p, or it may not, if you like (what really happens can be seen, considering the fact that all factors of m are either 8k+1 or 8k-1, and the 8k-1 factors exist always, and they are in an odd number, this is a simple exercise) but this is not important now. If m has a factor q, P-1 will find this factor if q-1 is B-smooth. Due to the form of the factors, you can place p in the product from the beginning (in fact you can place 2*p there, because if you get 3^(2*P*E)=1, you go back step by step - see the "basic algebra" reference above) and this is how you reduce the problem from "q-1 being B-smooth" to "k being B-smooth". From this link: "This method when adapted to Mersenne numbers is even more effective. Remember, that the factor q is of the form 2kp+1. It is easy to modify the P-1 method such that it will find the factor q whenever k is highly composite." This is how you "modify" it. That is, in fact, what I intended to say in the previous post. I can detail it (at the "entry level") if some beginner is interested. I am not intending to teach you math. You may consider the fact that for many of us, your math language is too advanced. So, let us talk our language. Last fiddled with by LaurV on 2011-11-10 at 06:28 |
|
![]() |
![]() |
![]() |
#14 | |
Romulan Interpreter
"name field"
Jun 2011
Thailand
37×271 Posts |
![]() Quote:
|
|
![]() |
![]() |
![]() |
#15 |
Basketry That Evening!
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88
3·29·83 Posts |
![]()
I would be interested in less advanced vocabulary. As has been discussed elsewhere, I've never studied and sort of number theory in any depth at all, and I have no idea what "order" means, and after that is where I get seriously lost. (Also, if p is prime, wouldn't any integer a be coprime to p?)
|
![]() |
![]() |
![]() |
#16 | |
Jun 2003
22·3·449 Posts |
![]() Quote:
Anyways, to understand P-1 algo, you don't need to know about orders and stuff. p, 2p, 3p, 4p, ... ![]() Last fiddled with by axn on 2011-11-10 at 07:42 Reason: Don't forget 1p |
|
![]() |
![]() |
![]() |
#17 | |
Jun 2003
22218 Posts |
![]() Quote:
Let E be a composite number. Let p be a prime number such that p-1 divides E. Specifically let p-1 = E/b for some integer b. Let a be an integer coprime to p. Fermat's Little Theorem states that ap-1 Elementary algebra tells us that aE-1 = ab(p-1)-1 is divisible by ap-1-1. Hence p divides aE-1. It should be noted that, for values of E large enough to be useful, aE-1 is an incalculably large number. What we can compute, without computing aE-1, is a small number congruent to it modulo N, i.e., (aE-1) - cN for some integer c. If p divides N, then p divides both terms, therefore divides their difference. Therefore p divides GCD((aE-1) - cN, N). This GCD may be N, in which case the algorithm has failed, otherwise it will be a (possibly composite) non-trivial proper factor of N. I hit submit too soon. What I haven't covered in the above, is the appropriate choice of E. Last fiddled with by Mr. P-1 on 2011-11-10 at 10:04 |
|
![]() |
![]() |
![]() |
#18 | |
Jun 2003
7×167 Posts |
![]() Quote:
E0 = 1 Ei = Ei-1 * ri Each new prime ri increases the size of E' (hence of E) by log2(ri) bits. This is proportional to the increase in the cost of the computation. The benefit of including ri will be proportional to ri-k[sub]i[/sub], where ki is the multiplicity of ri in Ei. The benefit is therefore hugely sensitive to the choice of ri, while the cost is relatively insensitive to that choice. To a first approximation, the best ri will be the one that minimises rik[sub]i[/sub]. The end result will be that, for any i, the powers of each prime factor r of Ei will be as close as possible. The choice usually implemented, which is that given in the wiki, is to make E' equal to the product of all primes powers less than some B1. This is near optimal. We call the computation of a small number congruent to aE-1 so chosen "stage 1". Stage 2 involves computing a small number congruent to (as[sub]1[/sub]*E-1)(as[sub]2[/sub]*E-1)(as[sub]2[/sub]*E-1)... for recessive primes sj between B1 and some B2. Each of the terms in the product substitutes s2*E for E in the stage 1 computation and finds any prime factor p=k*(known divisors) + 1 if k is divisible by s2 and k/s2 is power-smooth to B1. Computing a small number congruent to any term in the product individually would be tantamount to choosing a non-optimal choice of E for stage 1, and would not be cost effective, but using the method described in the wiki, and other tricks and techniques not described there, small numbers congruent to successive terms in the product can be calculated quite cheaply. Last fiddled with by Mr. P-1 on 2011-11-10 at 12:18 |
|
![]() |
![]() |
![]() |
#19 |
"Lucan"
Dec 2006
England
2×3×13×83 Posts |
![]() |
![]() |
![]() |
![]() |
#20 |
Nov 2011
22×3 Posts |
![]()
Does P95 in stage 1 of p-1 factoring:
- calculate E=p1*p2*p3*...., then calculate a^E mod N; - or calculate a1=a^p1 mod N, then a2=a1^p2 mod N, then a3=a2^p3 mod N, and so on; - or another way? p1, p2, p3, ... means powers of primes less then B1. Who can tell, please? Last fiddled with by Maximus on 2011-11-18 at 11:17 |
![]() |
![]() |
![]() |
#21 | |
Jun 2003
538810 Posts |
![]() Quote:
http://www.mersenneforum.org/gimps/ (look in ecm.c) |
|
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
A doubt about the correctness of the Four Colour Theorem | Raman | Puzzles | 4 | 2016-12-25 06:55 |
doubt with PARI and modular operations | skan | Software | 16 | 2013-04-01 16:54 |
TF algorithm(s) | davieddy | Miscellaneous Math | 61 | 2011-07-06 20:13 |
Is there an algorithm which solves this? | Unregistered | Homework Help | 0 | 2007-08-09 17:40 |
Maybe new sieving algorithm | nuggetprime | Riesel Prime Search | 5 | 2007-04-20 04:19 |