Integer factorization explained

In number theory, integer factorization is the decomposition of a positive integer into a product of integers. Every positive integer greater than 1 is either the product of two or more integer factors greater than 1, in which case it is called a composite number, or it is not, in which case it is called a prime number. For example, is a composite number because, but is a prime number because it cannot be decomposed in this way. If one of the factors is composite, it can in turn be written as a product of smaller factors, for example . Continuing this process until every factor is prime is called prime factorization; the result is always unique up to the order of the factors by the prime factorization theorem.

To factorize a small integer using mental or pen-and-paper arithmetic, the simplest method is trial division: checking if the number is divisible by prime numbers,,, and so on, up to the square root of . For larger numbers, especially when using a computer, various more sophisticated factorization algorithms are more efficient. A prime factorization algorithm typically involves testing whether each factor is prime each time a factor is found.

When the numbers are sufficiently large, no efficient non-quantum integer factorization algorithm is known. However, it has not been proven that such an algorithm does not exist. The presumed difficulty of this problem is important for the algorithms used in cryptography such as RSA public-key encryption and the RSA digital signature. Many areas of mathematics and computer science have been brought to bear on the problem, including elliptic curves, algebraic number theory, and quantum computing.

Not all numbers of a given length are equally hard to factor. The hardest instances of these problems (for currently known techniques) are semiprimes, the product of two prime numbers. When they are both large, for instance more than two thousand bits long, randomly chosen, and about the same size (but not too close, for example, to avoid efficient factorization by Fermat's factorization method), even the fastest prime factorization algorithms on the fastest computers can take enough time to make the search impractical; that is, as the number of digits of the integer being factored increases, the number of operations required to perform the factorization on any computer increases drastically.

Many cryptographic protocols are based on the difficulty of factoring large composite integers or a related problem—for example, the RSA problem. An algorithm that efficiently factors an arbitrary integer would render RSA-based public-key cryptography insecure.

Prime decomposition

By the fundamental theorem of arithmetic, every positive integer has a unique prime factorization. (By convention, 1 is the empty product.) Testing whether the integer is prime can be done in polynomial time, for example, by the AKS primality test. If composite, however, the polynomial time tests give no insight into how to obtain the factors.

Given a general algorithm for integer factorization, any integer can be factored into its constituent prime factors by repeated application of this algorithm. The situation is more complicated with special-purpose factorization algorithms, whose benefits may not be realized as well or even at all with the factors produced during decomposition. For example, if where are very large primes, trial division will quickly produce the factors 3 and 19 but will take divisions to find the next factor. As a contrasting example, if is the product of the primes,, and, where, Fermat's factorization method will begin with which immediately yields and hence the factors and . While these are easily recognized as composite and prime respectively, Fermat's method will take much longer to factor the composite number because the starting value of for is a factor of 10 from .

Current state of the art

See also: Integer factorization records.

Among the -bit numbers, the most difficult to factor in practice using existing algorithms are those semiprimes whose factors are of similar size. For this reason, these are the integers used in cryptographic applications.

In 2019, Fabrice Boudot, Pierrick Gaudry, Aurore Guillevic, Nadia Heninger, Emmanuel Thomé and Paul Zimmermann factored a 240-digit (795-bit) number (RSA-240) utilizing approximately 900 core-years of computing power.[1] The researchers estimated that a 1024-bit RSA modulus would take about 500 times as long.[2]

The largest such semiprime yet factored was RSA-250, an 829-bit number with 250 decimal digits, in February 2020. The total computation time was roughly 2700 core-years of computing using Intel Xeon Gold 6130 at 2.1 GHz. Like all recent factorization records, this factorization was completed with a highly optimized implementation of the general number field sieve run on hundreds of machines.

Time complexity

No algorithm has been published that can factor all integers in polynomial time, that is, that can factor a -bit number in time for some constant . Neither the existence nor non-existence of such algorithms has been proved, but it is generally suspected that they do not exist.

There are published algorithms that are faster than for all positive, that is, sub-exponential., the algorithm with best theoretical asymptotic running time is the general number field sieve (GNFS), first published in 1993,[3] running on a -bit number in time:

\exp\left(

23
+
\left(\left(\tfrac83\right)

o(1)\right)\left(log

13\left(log
log
n\right)
23\right).
n\right)

For current computers, GNFS is the best published algorithm for large (more than about 400 bits). For a quantum computer, however, Peter Shor discovered an algorithm in 1994 that solves it in polynomial time. Shor's algorithm takes only time and space on -bit number inputs. In 2001, Shor's algorithm was implemented for the first time, by using NMR techniques on molecules that provide seven qubits.[4]

In order to talk about complexity classes such as P, NP, and co-NP, the problem has to be stated as a decision problem.

It is known to be in both NP and co-NP, meaning that both "yes" and "no" answers can be verified in polynomial time. An answer of "yes" can be certified by exhibiting a factorization with . An answer of "no" can be certified by exhibiting the factorization of into distinct primes, all larger than ; one can verify their primality using the AKS primality test, and then multiply them to obtain . The fundamental theorem of arithmetic guarantees that there is only one possible string of increasing primes that will be accepted, which shows that the problem is in both UP and co-UP.[5] It is known to be in BQP because of Shor's algorithm.

The problem is suspected to be outside all three of the complexity classes P, NP-complete,[6] and co-NP-complete.It is therefore a candidate for the NP-intermediate complexity class.

In contrast, the decision problem "Is a composite number?" (or equivalently: "Is a prime number?") appears to be much easier than the problem of specifying factors of . The composite/prime problem can be solved in polynomial time (in the number of digits of) with the AKS primality test. In addition, there are several probabilistic algorithms that can test primality very quickly in practice if one is willing to accept a vanishingly small possibility of error. The ease of primality testing is a crucial part of the RSA algorithm, as it is necessary to find large prime numbers to start with.

Factoring algorithms

Special-purpose

A special-purpose factoring algorithm's running time depends on the properties of the number to be factored or on one of its unknown factors: size, special form, etc. The parameters which determine the running time vary among algorithms.

An important subclass of special-purpose factoring algorithms is the Category 1 or First Category algorithms, whose running time depends on the size of smallest prime factor. Given an integer of unknown form, these methods are usually applied before general-purpose methods to remove small factors.[7] For example, naive trial division is a Category 1 algorithm.

General-purpose

A general-purpose factoring algorithm, also known as a Category 2, Second Category, or Kraitchik family algorithm,[7] has a running time which depends solely on the size of the integer to be factored. This is the type of algorithm used to factor RSA numbers. Most general-purpose factoring algorithms are based on the congruence of squares method.

Other notable algorithms

Heuristic running time

In number theory, there are many integer factoring algorithms that heuristically have expected running time

(1+o(1))\sqrt{(logn)(loglogn)
L
n\left[\tfrac12,1+o(1)\right]=e
}in little-o and L-notation.Some examples of those algorithms are the elliptic curve method and the quadratic sieve.Another such algorithm is the class group relations method proposed by Schnorr,[8] Seysen,[9] and Lenstra,[10] which they proved only assuming the unproved generalized Riemann hypothesis.

Rigorous running time

The Schnorr–Seysen–Lenstra probabilistic algorithm has been rigorously proven by Lenstra and Pomerance to have expected running time by replacing the GRH assumption with the use of multipliers.The algorithm uses the class group of positive binary quadratic forms of discriminant denoted by . is the set of triples of integers in which those integers are relative prime.

Schnorr–Seysen–Lenstra algorithm

Given an integer that will be factored, where is an odd positive integer greater than a certain constant. In this factoring algorithm the discriminant is chosen as a multiple of,, where is some positive multiplier. The algorithm expects that for one there exist enough smooth forms in . Lenstra and Pomerance show that the choice of can be restricted to a small set to guarantee the smoothness result.

Denote by the set of all primes with Kronecker symbol . By constructing a set of generators of and prime forms of with in a sequence of relations between the set of generators and are produced.The size of can be bounded by for some constant .

The relation that will be used is a relation between the product of powers that is equal to the neutral element of . These relations will be used to construct a so-called ambiguous form of, which is an element of of order dividing 2. By calculating the corresponding factorization of and by taking a gcd, this ambiguous form provides the complete prime factorization of . This algorithm has these main steps:

Let be the number to be factored.To obtain an algorithm for factoring any positive integer, it is necessary to add a few steps to this algorithm such as trial division, and the Jacobi sum test.

Expected running time

The algorithm as stated is a probabilistic algorithm as it makes random choices. Its expected running time is at most .[11]

See also

References

External links

Notes and References

  1. Web site: [Cado-nfs-discuss] 795-bit factoring and discrete logarithms]. dead. https://web.archive.org/web/20191202190004/https://lists.gforge.inria.fr/pipermail/cado-nfs-discuss/2019-December/001139.html. 2019-12-02.
  2. Kleinjung . Thorsten . Aoki . Kazumaro . Franke . Jens . Lenstra . Arjen K. . Thomé . Emmanuel . Bos . Joppe W. . Gaudry . Pierrick . Kruppa . Alexander . Montgomery . Peter L. . Osvik . Dag Arne . te Riele . Herman J. J. . Timofeev . Andrey . Zimmermann . Paul . Rabin . Tal . Factorization of a 768-Bit RSA Modulus . https://eprint.iacr.org/2010/006.pdf . 10.1007/978-3-642-14623-7_18 . 333–350 . Springer . Lecture Notes in Computer Science . Advances in Cryptology - CRYPTO 2010, 30th Annual Cryptology Conference, Santa Barbara, CA, USA, August 15-19, 2010. Proceedings . 6223 . 2010.
  3. Book: Buhler . J. P. . Lenstra . H. W. Jr. . Pomerance . Carl . Factoring integers with the number field sieve . The development of the number field sieve . 1993 . Springer . 978-3-540-57013-4 . 50–94 . 10.1007/BFb0091539 . 1887/2149 . Lecture Notes in Mathematics . 1554 . 12 March 2021 . English.
  4. 10.1038/414883a . Experimental realization of Shor's quantum factoring algorithm using nuclear magnetic resonance . . 414 . 883–887 . 2001 . Vandersypen . Lieven M. K. . 6866 . etal. quant-ph/0112176 . 11780055 . 2001Natur.414..883V . 4400832.
  5. Web site: Lance Fortnow . Computational Complexity Blog: Complexity Class of the Week: Factoring . 2002-09-13 .
  6. . See in particular p. 583.
  7. Book: . 2000 . A Course in Computational Number Theory . Key College Publishing/Springer . 978-1-930190-10-8 . 168–69 . registration .
  8. Schnorr. Claus P.. 1982. Refined analysis and improvements on some factoring algorithms. Journal of Algorithms. 3. 101–127 . 10.1016/0196-6774(82)90012-8 . 2 . 0657269. https://web.archive.org/web/20170924140543/http://www.dtic.mil/get-tr-doc/pdf?AD=ADA096348. dead. September 24, 2017.
  9. Seysen. Martin. 1987. A probabilistic factorization algorithm with quadratic forms of negative discriminant. Mathematics of Computation. 48. 757–780. 10.1090/S0025-5718-1987-0878705-X. 178 . 0878705. free.
  10. Lenstra. Arjen K. 1988. Fast and rigorous factorization under the generalized Riemann hypothesis. Indagationes Mathematicae. 50. 4. 443–454. 10.1016/S1385-7258(88)80022-2.
  11. H. W. . Lenstra. Carl. Pomerance . July 1992 . A Rigorous Time Bound for Factoring Integers . Journal of the American Mathematical Society . 5 . 483–516. 10.1090/S0894-0347-1992-1137100-0 . 3 . 1137100. free .