the number field sieve finding small factors of integers
play

The number-field sieve Finding small factors of integers D. J. - PDF document

The number-field sieve Finding small factors of integers D. J. Bernstein University of Illinois at Chicago The Q sieve factors n by combining enough y -smooth congruences i ( n + i ). Enough > = log y . y Plausible


  1. The number-field sieve Finding small factors of integers D. J. Bernstein University of Illinois at Chicago

  2. The Q sieve factors n by combining enough y -smooth congruences i ( n + i ). “Enough” � “ > = log y .” y Plausible conjecture: if y 2 q � 1 � exp 2 + o (1) log n log log n y 2+ o (1) congruences then have enough smooth congruences. Linear sieve, quadratic sieve, random-squares method, number-field sieve, etc.: similar. Also combine congruences for discrete logs, class groups, etc.

  3. � � � Finding small factors Find smooth congruences by finding small factors of many congruences: Neverending supply of congruences select Smallest congruences find small factors Partial factorizations using primes � y abort non-smooth Smooth congruences

  4. How to find small factors? Could use trial division: For each congruence, remove factors of 2, remove factors of 3, remove factors of 5, etc.; use all primes y . p � y 3+ o (1) bit operations: y 1+ o (1) per congruence. Want something faster!

  5. � � � � � Early aborts Neverending supply of congruences select Smallest congruences Partial factorizations y 1 = 2 using primes � early abort Smallest unfactored parts Partial factorizations using primes � y final abort Smooth congruences

  6. Find small primes by trial division. y 1 = 2+ o (1) for primes y 1 = 2 . Cost � y 1+ o (1) for primes Cost y . � Say we choose “smallest” so that each congruence y 1 = 2+ o (1) =y 1+ o (1) has chance of surviving early abort. Have reduced trial-division y 1 = 2+ o (1) . cost by factor Fact: A y -smooth congruence � 1 = 4+ o (1) has chance y of surviving early abort. Have reduced identify-a-smooth y 1 = 4+ o (1) . cost by factor

  7. Example from Andrew Shallue: A uniform random integer in [1 ; 2 64 � 8 : 1 � 1] has chance about 2 of being 2 15 -smooth, chance about � 3 : 5 of having 2 7 -unfactored part 2 below 2 44 , and chance about 2 � 9 : 8 of satisfying both conditions. Given congruence, find primes � 2 7 ; abort if unfactored part is above 2 44 ; then find primes � 2 15 . Compared to skipping the abort: about 2 3 : 5 times faster, about 2 1 : 7 times less productive; gain 2 1 : 8 .

  8. More generally, can abort at y 1 =k , y 2 =k , etc. Balance stages to reduce cost per congruence y 1+ o (1) to y 1 =k + o (1) . from Fact: A y -smooth congruence has relatively good chance of surviving early abort. Have reduced identify-a-smooth y (1 � 1 =k ) = 2+ o (1) . cost by factor Increase k slowly with y . Find enough smooth congruences y 2 : 5+ o (1) bit operations. using Want something faster!

  9. Sieving Textbook answer: Sieving finds enough smooth congruences y 2+ o (1) bit operations. using only To sieve: Generate in order of p , then sort in order of i , all pairs ( p ) with i; i in range and i ( n + i ) p Z . 2 Pairs for one p are ( p ), (2 p ), (3 p ), etc. p; p; p; and ( � ( n mod p ) p ) etc. p ; e.g. y = 10, n = 611, f 1 ; 2 ; ; 100 g : i 2 : : :

  10. For p = 2 generate pairs (2 ; 2) ; (4 ; 2) ; (6 ; 2) ; (100 ; 2) ; : : : and (1 ; 2) ; (3 ; 2) ; (5 ; 2) ; (99 ; 2). ; : : : For p = 3 generate pairs (3 ; 3) ; (6 ; 3) ; (99 ; 3) and ; : : : (1 ; 3) ; (4 ; 3) ; (100 ; 3). ; : : : For p = 5 generate pairs (5 ; 5) ; (10 ; 5) ; (100 ; 5) and ; : : : (4 ; 5) ; (9 ; 5) ; (99 ; 5). ; : : : For p = 7 generate pairs (7 ; 7) ; (14 ; 7) ; (98 ; 7) and ; : : : (5 ; 7) ; (12 ; 7) ; (96 ; 7). ; : : :

  11. Sort pairs by first coordinate: (1 ; 2), (1 ; 3), (2 ; 2), (3 ; 2), (3 ; 3), (4 ; 2), (4 ; 3), (4 ; 5), : , (98 ; 2), : : (98 ; 7), (99 ; 2), (99 ; 3), (99 ; 5), (100 ; 2), (100 ; 3), (100 ; 5). Sorted list shows that the small primes in i ( n + i ) are 2 ; 3 for i = 1; 2 for i = 2; : : : 2 ; 7 for i = 98; 2 ; 3 ; 5 for i = 99; 2 ; 3 ; 5 for i = 100.

  12. y 2 � � In general, for 1 ; : i 2 : : : ; y 2 Prime p produces =p pairs � ( p ), (2 p ), (3 p ), etc. p; p; p; y 2 and produces =p pairs � ( � ( n mod p ) p ) etc. p ; Total number of pairs � � 2 y 2 log log p � y 2 y 2 P y . =p Easily generate pairs, sort, and finish checking smoothness, O (1) bit operations. y 2 (lg in y ) O (1) bit operations Only (lg y ) per congruence.

  13. Hidden costs Is that what we do in record-setting factorizations? No! Sieving has two big problems. First problem: Sieving needs large i range. For speed, must use batch of y 1+ o (1) consecutive i ’s. � Limits number of sublattices, so limits smoothness chance. Can eliminate this problem using “remainder trees.”

  14. Product trees Given m , 1 2 ; ; : : : ; O (1) bits: together having y (lg y ) Can compute 1 2 � � � m O (1) operations. with y (lg y ) Actually compute “product tree” of m . 1 2 ; ; : : : ; Root: m . 1 2 � � � Left subtree if � 2: m product tree of m= 2 e . 1 ; : : : ; d Right subtree if � 2: m product tree of m . m= 2 e +1 ; : : : ; d

  15. � � � � � e.g. tree for 23 ; 29 ; 84 ; 15 ; 58 ; 19: 926142840 � ����� � � � 56028 16530 � ��� � ��� � � � � � � 667 84 870 19 � ��� � ��� � � � � � � 23 29 15 58 Obtain each level of tree O (1) operations with y (lg y ) by multiplying lower-level pairs. Use FFT-based multiplication.

  16. � � � � � Remainder trees Remainder tree of m has one 1 2 P ; ; ; : : : ; node P mod C for each node C in product tree of m . 1 2 ; ; : : : ; e.g. remainder tree of 223092870 ; 23 ; 29 ; 84 ; 15 ; 58 ; 19: 223092870 � � � ��� � � � � 45402 3990 � � � � � ��� � ��� � � 46 42 510 0 � � � � � � � � � � � � � � 0 17 0 46

  17. Use product tree to compute product P of primes y . p � Use remainder tree to compute P mod P mod : . 1 2 ; ; : : Now 1 is y -smooth k mod P 2 iff 1 = 0 for � 0 with 2 2 minimal 1 . k k � Similarly 2 etc. O (1) operations Total y (lg y ) if : together 1 2 ; ; : : O (1) bits. have y (lg y )

  18. Hidden costs, continued Second problem with sieving, not fixed by remainder trees: y 1+ o (1) bits of storage. Need Real machines don’t have much fast memory: it’s expensive. Effect is not visible for small computations on single serial CPUs, but becomes critical in huge parallel computations. How to quickly find primes above size of fast memory?

  19. The rho method � 2 Define � 0 = 0, k +1 = k + 11. � � 2 20 divides Every prime S = ( � 2 )( � 4 )( � 6 ) � 1 � 2 � 3 � � � � ( � 7150 ). � 3575 � � � Also many larger primes. Can compute gcd g using f ; S � 2 14 multiplications mod , very little memory. � 2 16 divisions Compare to for trial division up to 2 20 .

  20. More generally: Choose z . Compute gcd g where S = f ; S ( � 2 )( � 4 ) � ( � 2 z ). � 1 � 2 � � � � � � z How big does z have to be for all primes y to divide S ? � y 1 = 2+ o (1) ; Plausible conjecture: y 1 = 2+ o (1) mults mod so . y 1 = 4+ o (1) mults. Early-abort rho: Reason: Consider first collision in � 1 mod � 2 mod : . p; p; : : If i mod p = j mod � � p then k mod p = � 2 k mod � p for 2 ( i ) Z \ [ i; 1 ] \ [ j; 1 ]. k j �

  21. The � 1 method p Have built an integer S divisible by all primes y . � Less costly way to do this? First attempt: Choose z . S 1 = 2 lcm f 1 ; 2 ; 3 ;::: Define � 1. ;z g If lcm 2 ( � 1) Z then p Z . S 1 p 2 Can tweak to find more p ’s: e.g., could instead use product of 2 lcm � 1 and 2 lcm � q � 1 for all primes 2 [ z + 1 ; z log z ]; q could replace lcm by lcm 2 .

  22. e.g. z = 20: lcm = lcm f 1 ; 2 ; 3 ; ; 20 g : : : = 2 4 � 3 2 � 5 � 7 � 11 � 13 � 17 � 19 = 232792560. S 1 = 2 lcm � 1 has prime divisors 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 53, 61, 67, 71, 73, 79, 89, 97, 103, 109, 113, 127, 131, 137, 151, 157, 181, 191, 199, etc. Compute S 1 with 34 mults.

  23. As 1 : (1 : 44 : + o (1)) z ! : : z multiplications to compute S 1 . Dividing lcm f 1 ; g is stronger : : : ; z than z -smoothness but not much. Plausible conjecture: if z 2 q � 1 � exp 2 + o (1) log y log log y then � 1 divides lcm f 1 ; p : : : ; z g with chance 1 =z 1+ o (1) for uniform random prime y . p � So method finds some primes at surprisingly high speed. What about the other primes?

  24. The p + 1 method Second attempt: Define v 0 = 2, v 1 = 10, v 2 v 2 i = � 2, i v 2 i +1 = v 1 . i +1 v v � i Define S 2 = � 2. v lcm f 1 ; 2 ; 3 ;:::;z g Point of i formulas: v i + i = � i v � � � 2 in Z [ � ] = ( � 10 � + 1). If lcm f 1 ; 2 ; 3 ; 2 ( p + 1) Z : : : ; z g and 10 2 � 4 non-square in F p � 2 then F p [ � ] = ( � 10 � + 1) is a field so p Z . S 2 2

  25. e.g. z = 20, lcm = 232792560: S 2 = � 2 has prime divisors 3, v lcm 5, 7, 11, 13, 17, 19, 23, 29, 37, 41, 43, 53, 59, 67, 71, 73, 79, 83, 89, 97, 103, 109, 113, 131, 151, 179, 181, 191, 211, 227, 233, 239, 241, 251, 271, 307, 313, 331, 337, 373, 409, 419, 439, 457, 467, 547, 569, 571, 587, 593, 647, 659, 673, 677, 683, 727, 857, 859, 881, 911, 937, 967, 971, etc.

Recommend


More recommend