Integer factorization: Difference between revisions

Content deleted Content added
m add one more example
Bender the Bot (talk | contribs)
m External links: HTTP to HTTPS for SourceForge
 
(38 intermediate revisions by 25 users not shown)
Line 1:
{{Short description|Decomposition of a number into a product}}
{{Redirect|Prime decomposition|the prime decomposition theorem for 3-manifolds|Prime decomposition (of 3-manifold)manifolds}}
{{unsolved|computer science|Can integer factorization be solved in polynomial time on a classical computer?}}
 
In [[number theorymathematics]], '''integer factorization''' is the decomposition of a [[positive integer]] into a [[Product (mathematics)|product]] of integers. Every positive integer greater than 1 is either the product of two or more integer [[divisor|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, {{math|15}} is a composite number because {{math|1=15 = 3 · 5}}, but {{math|7}} 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 {{math|1=60 = 3 · 20 = 3 · (5 · 4)}}. 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]]. A prime factorization algorithm typically involves [[primality test|testing whether each factor is prime]] after each step.
 
To factorize a small integer {{mvar|n}} using mental or pen-and-paper arithmetic, the simplest method is [[trial division]]: checking if the number is divisible by prime numbers {{math|2}}, {{math|3}}, {{math|5}}, and so on, up to the [[square root]] of {{mvar|n}}. For larger numbers, especially when using a computer, various more sophisticated factorization algorithms are more efficient. A prime factorization algorithm typically involves [[primality test|testing whether each factor is prime]] each time a factor is found.
When the numbers are sufficiently large, no efficient [[quantum computer|non-quantum]] integer [[factorization]] [[algorithm]] is known. However, it has not been proven that such an algorithm does not exist. The presumed [[Computational hardness assumption|difficulty]] of this problem is important for the algorithms used in [[cryptography]] such as [[RSA (cryptosystem)|RSA public-key encryption]] and the [[Digital Signature Algorithm|RSA digital signature]].<ref>{{Citation |last=Lenstra |first=Arjen K. |title=Integer Factoring |date=2011 |url=http://link.springer.com/10.1007/978-1-4419-5906-5_455 |encyclopedia=Encyclopedia of Cryptography and Security |pages=611–618 |editor-last=van Tilborg |editor-first=Henk C. A. |place=Boston, MA |publisher=Springer US |language=en |doi=10.1007/978-1-4419-5906-5_455 |isbn=978-1-4419-5905-8 |access-date=2022-06-22 |editor2-last=Jajodia |editor2-first=Sushil}}</ref> Many areas of [[mathematics]] and [[computer science]] have been brought to bear on the problem, including [[elliptic curve]]s, [[algebraic number theory]], and [[quantum computer|quantum computing]].
 
When the numbers are sufficiently large, no efficient non-[[quantum computer|non-quantum]] integer [[factorization]] [[algorithm]] is known. However, it has not been proven that such an algorithm does not exist. The presumed [[Computational hardness assumption|difficulty]] of this problem is important for the algorithms used in [[cryptography]] such as [[RSA (cryptosystem)|RSA public-key encryption]] and the [[Digital Signature Algorithm|RSA digital signature]].<ref>{{Citation |last=Lenstra |first=Arjen K. |title=Integer Factoring |date=2011 |url=http://link.springer.com/10.1007/978-1-4419-5906-5_455 |encyclopedia=Encyclopedia of Cryptography and Security |pages=611–618 |editor-last=van Tilborg |editor-first=Henk C. A. |place=Boston, MA |publisher=Springer US |language=en |doi=10.1007/978-1-4419-5906-5_455 |isbn=978-1-4419-5905-8 |access-date=2022-06-22 |editor2-last=Jajodia |editor2-first=Sushil }}</ref> Many areas of [[mathematics]] and [[computer science]] have been brought to bear on thethis problem, including [[elliptic curve]]s, [[algebraic number theory]], and [[quantum computer|quantum computing]].
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.<ref>{{cite web| url = https://lists.gforge.inria.fr/pipermail/cado-nfs-discuss/2019-December/001139.html| url-status = dead| archive-url = https://web.archive.org/web/20191202190004/https://lists.gforge.inria.fr/pipermail/cado-nfs-discuss/2019-December/001139.html| archive-date = 2019-12-02| title = [Cado-nfs-discuss] 795-bit factoring and discrete logarithms}}</ref> The researchers estimated that a 1024-bit RSA modulus would take about 500 times as long.<ref name=rsa768>{{cite journal
| url = http://eprint.iacr.org/2010/006.pdf
| title = Factorization of a 768-bit RSA modulus
| author = Kleinjung| publisher = [[International Association for Cryptologic Research]]
| date = 2010-02-18
| access-date = 2010-08-09
|display-authors=etal}}</ref>
 
Not all numbers of a given length are equally hard to factor. The hardest instances of these problems (for currently known techniques) are [[semiprime]]s, the product of two prime numbers. When they are both large, for instance more than two thousand [[bit]]s 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 classical 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 classical computer increases drastically.
 
Many cryptographic protocols are based on the presumed difficulty of factoring large composite integers or a related problem—forproblem {{Ndash}}for example, the [[RSA problem]]. An algorithm that efficiently factors an arbitrary integer would render [[RSA (algorithm)|RSA]]-based [[public-key]] cryptography insecure.
 
== Prime decomposition ==
[[Image:PrimeDecompositionExample.svg|right|thumb|Prime decomposition of {{math|''n'' {{=}} 864}} as {{math|2<sup>5</sup> × 3<sup>3</sup>}}]]
By the [[fundamental theorem of arithmetic]], every positive integer has a unique [[prime factor]]ization. (By convention, 1 is the [[empty product]].) [[Primality test|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 factor]]s 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 {{nowrapmath|1=''n'' = 171 × ''p'' × ''q''}} where {{nowrapmath|''p'' < ''q''}} are very large primes, [[trial division]] will quickly produce the factors 3 and 19 but will take {{math|''p''}} divisions to find the next factor. As a contrasting example, if {{math|''n''}} is the product of the primes {{math|13729}}, {{math|1372933}}, and {{math|18848997161}}, where {{nowrapmath|1=13729 × 1372933 = 18848997157}}, Fermat's factorization method will begin with <{{math>\left\lceil\sqrt|⌈{{sqrt|''n''}\right\rceil}⌉ {{=}} 18848997159 </math>}} which immediately yields <{{math display="inline">|''b'' {{=}} \sqrt{{sqrt|''a^''<sup>2</sup> - ''n''}} {{=}} \sqrt{{sqrt|4}} {{=}} 2 </math>}} and hence the factors {{nowrapmath|1=''a'' − ''b'' = 18848997157}} and {{nowrapmath|1=''a'' + ''b'' = 18848997161}}. 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 <{{math display="inline">\left\lceil\sqrt|⌈{{sqrt|18848997157}\,\right\rceil}⌉ {{=}} 137292 </math>}} for {{math|''a''}} is a factor of 10 from {{math|1372933}}.
 
== Current state of the art ==
{{See also|Integer factorization records}}
Among the ''b''-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. The largest such semiprime yet factored was [[RSA numbers#RSA-250|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 [[Skylake (microarchitecture)#Xeon Gold (quad processor)|Xeon Gold]] 6130 at 2.1&nbsp;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.
 
Among the {{math|''b''}}-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.
=== Difficulty and complexity ===
No [[algorithm]] has been published that can factor all integers in [[polynomial time]], that is, that can factor a ''b''-bit number ''n'' in time [[Big O notation|O]](''b''<sup>''k''</sup>) for some constant ''k''. Neither the existence nor non-existence of such algorithms has been proved, but it is generally suspected that they do not exist and hence that the problem is not in class P.<ref>{{citation |last=Krantz |first=Steven G. |author-link=Steven G. Krantz |doi=10.1007/978-0-387-48744-1 |isbn=978-0-387-48908-7 |___location=New York |mr=2789493 |page=203 |publisher=Springer |title=The Proof is in the Pudding: The Changing Nature of Mathematical Proof |url=https://books.google.com/books?id=mMZBtxVZiQoC&pg=PA203 |year=2011}}</ref><ref>{{citation |last1=Arora |first1=Sanjeev |author1-link=Sanjeev Arora |last2=Barak |first2=Boaz |doi=10.1017/CBO9780511804090 |isbn=978-0-521-42426-4 |___location=Cambridge |mr=2500087 |page=230 |publisher=Cambridge University Press |title=Computational complexity |url=https://books.google.com/books?id=nGvI7cOuOOQC&pg=PA230 |year=2009|s2cid=215746906 }}</ref> The problem is clearly in class NP, but it is generally suspected that it is not [[NP-complete]], though this has not been proven.<ref>{{citation |last1=Goldreich |first1=Oded |author1-link=Oded Goldreich |last2=Wigderson |first2=Avi |author2-link=Avi Wigderson |editor1-last=Gowers |editor1-first=Timothy |editor1-link=Timothy Gowers |editor2-last=Barrow-Green |editor2-first=June |editor2-link=June Barrow-Green|editor3-last=Leader |editor3-first=Imre |editor3-link=Imre Leader |contribution=IV.20 Computational Complexity |isbn=978-0-691-11880-2 |___location=Princeton, New Jersey |mr=2467561 |pages=575–604 |publisher=Princeton University Press |title=The Princeton Companion to Mathematics |year=2008}}. See in particular [https://books.google.com/books?id=ZOfUsvemJDMC&pg=PA583 p.&nbsp;583].</ref>
 
In 2019, Fabrice Boudot, Pierrick Gaudry, Aurore Guillevic, Nadia Heninger, Emmanuel Thomé and Paul Zimmermann factored a 240-digit (795-bit) number ([[RSA-240]]) was factored by a team of researchers including [[Paul Zimmermann (mathematician)|Paul Zimmermann]], utilizing approximately 900 core-years of computing power.<ref>{{cite web| url = https://lists.gforge.inria.fr/pipermail/cado-nfs-discuss/2019-December/001139.html| url-status = dead| archive-url = https://web.archive.org/web/20191202190004/https://lists.gforge.inria.fr/pipermail/cado-nfs-discuss/2019-December/001139.html| archive-date = 2019-12-02| title = [Cado-nfs-discuss] 795-bit factoring and discrete logarithms}}</ref> TheThese researchers estimated that a 1024-bit RSA modulus would take about 500 times as long.<ref name=rsa768>{{cite journalconference
There are published algorithms that are faster than {{nowrap|O((1 + ''ε'')<sup>''b''</sup>)}} for all positive ''ε'', that is, [[Time complexity#Sub-exponential time|sub-exponential]]. {{As of|2022}}, the algorithm with best theoretical asymptotic running time is the [[general number field sieve]] (GNFS), first published in 1993,<ref>{{cite book |last1=Buhler |first1=J. P. |last2=Lenstra |first2=H. W. Jr. |last3=Pomerance |first3=Carl |title=Factoring integers with the number field sieve |date=1993 |publisher=Springer |isbn=978-3-540-57013-4 |pages=50–94 |doi=10.1007/BFb0091539 |hdl=1887/2149 |edition=Lecture Notes in Mathematics, vol 1554 |url=https://doi.org/10.1007/BFb0091539 |access-date=12 March 2021 |language=English}}</ref> running on a ''b''-bit number ''n'' in time:
| last1 = Kleinjung | first1 = Thorsten
: <math>\exp\left( \bigl((8/3)^{2/3} + o(1)\bigr)(\ln n)^{1/3}(\ln \ln n)^{2/3}\right).</math>
| last2 = Aoki | first2 = Kazumaro
| last3 = Franke | first3 = Jens
| last4 = Lenstra | first4 = Arjen K.
| last5 = Thomé | first5 = Emmanuel
| last6 = Bos | first6 = Joppe W.
| last7 = Gaudry | first7 = Pierrick
| last8 = Kruppa | first8 = Alexander
| last9 = Montgomery | first9 = Peter L.
| last10 = Osvik | first10 = Dag Arne
| last11 = te Riele | first11 = Herman J. J.
| last12 = Timofeev | first12 = Andrey
| last13 = Zimmermann | first13 = Paul
| editor-last = Rabin | editor-first = Tal
| titlecontribution = Factorization of a 768-bitBit RSA modulusModulus
| contribution-url = httphttps://eprint.iacr.org/2010/006.pdf
| doi = 10.1007/978-3-642-14623-7_18
| pages = 333–350
| publisher = Springer
| series = Lecture Notes in Computer Science
| title = Advances in Cryptology - CRYPTO 2010, 30th Annual Cryptology Conference, Santa Barbara, CA, USA, August 15-19, 2010. Proceedings
| volume = 6223
| year = 2010| isbn = 978-3-642-14622-0
}}</ref>
 
Among the ''b''-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. The largest such semiprime yet factored was [[RSA numbers#RSA-250|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 [[Skylake (microarchitecture)#Xeon Gold (quad processor)|Xeon Gold]] 6130 at 2.1&nbsp;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.
For current computers, GNFS is the best published algorithm for large ''n'' (more than about 400 bits). For a [[Quantum computing|quantum computer]], however, [[Peter Shor]] discovered an algorithm in 1994 that solves it in polynomial time. This will have significant implications for cryptography if quantum computation becomes scalable. [[Shor's algorithm]] takes only O(''b''<sup>3</sup>) time and O(''b'') space on ''b''-bit number inputs. In 2001, Shor's algorithm was implemented for the first time, by using [[Nuclear magnetic resonance|NMR]] techniques on molecules that provide seven qubits.<ref>
 
=== Difficulty andTime complexity ===
 
No [[algorithm]] has been published that can factor all integers in [[polynomial time]], that is, that can factor a {{math|''b''}}-bit number {{math|''n''}} in time {{math|[[Big O notation|O]](''b''<sup>''k''</sup>)}} for some constant {{math|''k''}}. Neither the existence nor non-existence of such algorithms has been proved, but it is generally suspected that they do not exist and hence that the problem is not in class P.<ref>{{citation |last=Krantz |first=Steven G. |author-link=Steven G. Krantz |doi=10.1007/978-0-387-48744-1 |isbn=978-0-387-48908-7 |___location=New York |mr=2789493 |page=203 |publisher=Springer |title=The Proof is in the Pudding: The Changing Nature of Mathematical Proof |url=https://books.google.com/books?id=mMZBtxVZiQoC&pg=PA203 |year=2011}}</ref><ref>{{citation |last1=Arora |first1=Sanjeev |author1-link=Sanjeev Arora |last2=Barak |first2=Boaz |doi=10.1017/CBO9780511804090 |isbn=978-0-521-42426-4 |___location=Cambridge |mr=2500087 |page=230 |publisher=Cambridge University Press |title=Computational complexity |url=https://books.google.com/books?id=nGvI7cOuOOQC&pg=PA230 |year=2009|s2cid=215746906 }}</ref> The problem is clearly in class NP, but it is generally suspected that it is not [[NP-complete]], though this has not been proven.<ref>{{citation |last1=Goldreich |first1=Oded |author1-link=Oded Goldreich |last2=Wigderson |first2=Avi |author2-link=Avi Wigderson |editor1-last=Gowers |editor1-first=Timothy |editor1-link=Timothy Gowers |editor2-last=Barrow-Green |editor2-first=June |editor2-link=June Barrow-Green|editor3-last=Leader |editor3-first=Imre |editor3-link=Imre Leader |contribution=IV.20 Computational Complexity |isbn=978-0-691-11880-2 |___location=Princeton, New Jersey |mr=2467561 |pages=575–604 |publisher=Princeton University Press |title=The Princeton Companion to Mathematics |year=2008}}. See in particular [https://books.google.com/books?id=ZOfUsvemJDMC&pg=PA583 p.&nbsp;583].</ref>
 
There are published algorithms that are faster than {{nowrapmath|O((1 + ''ε'')<sup>''b''</sup>)}} for all positive {{math|''ε''}}, that is, [[Time complexity#Sub-exponential time|sub-exponential]]. {{As of|2022}}, the algorithm with best theoretical asymptotic running time is the [[general number field sieve]] (GNFS), first published in 1993,<ref>{{cite book |last1=Buhler |first1=J. P. |last2=Lenstra |first2=H. W. Jr. |last3=Pomerance |first3=Carl |titlechapter=Factoring integers with the number field sieve |title=The development of the number field sieve |date=1993 |publisher=Springer |isbn=978-3-540-57013-4 |pages=50–94 |doi=10.1007/BFb0091539 |hdl=1887/2149 |editionseries=Lecture Notes in Mathematics, vol |volume=1554 |url=https://doi.org/10.1007/BFb0091539 |access-date=12 March 2021 |language=English}}</ref> running on a {{math|''b''}}-bit number {{math|''n''}} in time:
: <math>\exp\left( \biglleft(\left(8/3\tfrac83\right)^{2/3}\frac23 + o(1)\bigrright)\left(\lnlog n\right)^{1/3}\frac13\left(\lnlog \lnlog n\right)^{2/3}\frac23\right).</math>
 
For current computers, GNFS is the best published algorithm for large {{math|''n''}} (more than about 400 bits). For a [[Quantum computing|quantum computer]], however, [[Peter Shor]] discovered an algorithm in 1994 that solves it in polynomial time. This will have significant implications for cryptography if quantum computation becomes scalable. [[Shor's algorithm]] takes only {{math|O(''b''<sup>3</sup>)}} time and {{math|O(''b'')}} space on {{math|''b''}}-bit number inputs. In 2001, Shor's algorithm was implemented for the first time, by using [[Nuclear magnetic resonance|NMR]] techniques on molecules that provide seven qubits.<ref>
{{cite journal
| doi = 10.1038/414883a
Line 50 ⟶ 74:
}}</ref>
 
In order to talk about [[complexity class|complexity classes]] such as P, NP, and co-NP, the problem has to be stated as a [[decision problem]].
It is not known exactly which [[complexity class]]es contain the [[decision problem|decision version]] of the integer factorization problem (that is: does ''n'' have a factor smaller than ''k'' besides 1?). It is known to be in both [[NP (complexity)|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 {{nowrap|1=''n'' = ''d''(''n''/''d'')}} with {{nowrap|''d'' ≤ ''k''}}. An answer of "no" can be certified by exhibiting the factorization of ''n'' into distinct primes, all larger than ''k''; one can verify their primality using the [[AKS primality test]], and then multiply them to obtain ''n''. 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 (complexity)|UP]] and co-UP.<ref>
 
{{Math theorem |For every natural numbers <math>n</math> and <math>k</math>, does {{math|''n''}} have a factor smaller than {{math|''k''}} besides 1? |name=Decision problem |note=Integer factorization }}
 
It is not known exactly which [[complexity class]]es contain the [[decision problem|decision version]] of the integer factorization problem (that is: does ''n'' have a factor smaller than ''k'' besides 1?). It is known to be in both [[NP (complexity)|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 {{nowrapmath|1=''n'' = ''d''({{sfrac|''n''/|''d''}})}} with {{nowrapmath|''d'' ≤ ''k''}}. An answer of "no" can be certified by exhibiting the factorization of {{math|''n''}} into distinct primes, all larger than {{math|''k''}}; one can verify their primality using the [[AKS primality test]], and then multiply them to obtain {{math|''n''}}. 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 (complexity)|UP]] and co-UP.<ref>
{{cite web
| author = Lance Fortnow
Line 58 ⟶ 86:
}}</ref> 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,<ref>{{citation |last1=Goldreich |first1=Oded |author1-link=Oded Goldreich |last2=Wigderson |first2=Avi |author2-link=Avi Wigderson |editor1-last=Gowers |editor1-first=Timothy |editor1-link=Timothy Gowers |editor2-last=Barrow-Green |editor2-first=June |editor2-link=June Barrow-Green|editor3-last=Leader |editor3-first=Imre |editor3-link=Imre Leader |contribution=IV.20 Computational Complexity |isbn=978-0-691-11880-2 |___location=Princeton, New Jersey |mr=2467561 |pages=575–604 |publisher=Princeton University Press |title=The Princeton Companion to Mathematics |year=2008}}. See in particular [https://books.google.com/books?id=ZOfUsvemJDMC&pg=PA583 p.&nbsp;583].</ref> and [[co-NP-complete]].
The problem is suspected to be outside all three of the complexity classes P, NP-complete, and [[co-NP-complete]]. It is therefore a candidate for the [[NP-intermediate]] complexity class. If it could be proved to be either NP-complete or co-NP-complete, this would imply NP = co-NP, a very surprising result, and therefore integer factorization is widely suspected to be outside both these classes.
It is therefore a candidate for the [[NP-intermediate]] complexity class.
 
In contrast, the decision problem "Is {{math|''n''}} a composite number?" (or equivalently: "Is {{math|''n''}} a prime number?") appears to be much easier than the problem of specifying factors of {{math|''n''}}. The composite/prime problem can be solved in polynomial time (in the number {{math|''b''}} of digits of {{math|''n''}}) with the [[AKS primality test]]. In addition, there are several [[randomized algorithm|probabilistic algorithm]]s that can test primality very quickly in practice if one is willing to accept a vanishingly small possibility of error. The ease of [[primality test]]ing is a crucial part of the [[RSA (algorithm)|RSA]] algorithm, as it is necessary to find large prime numbers to start with.
 
== Factoring algorithms <!-- This section is linked from [[Factorization]] --> ==
Line 82 ⟶ 111:
* [[Wheel factorization]]
* [[Pollard's rho algorithm]], which has two common flavors to [[Cycle detection|identify group cycles]]: one by Floyd and one by Brent.
* [[Algebraic-group factorisation algorithms|Algebraic-group factorization algorithms]], among which are [[Pollard's p − 1 algorithm|Pollard's {{math|''p''&nbsp; &nbsp; 1}} algorithm]], [[Williams' p + 1 algorithm|Williams' {{math|''p''&nbsp; +&nbsp; 1}} algorithm]], and [[Lenstra elliptic curve factorization]]
* [[Fermat's factorization method]]
* [[Euler's factorization method]]
* [[Special number field sieve]]
* [[Difference of two squares]]
 
=== General-purpose ===
Line 105 ⟶ 135:
in [[Big O notation|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,<ref name=1982-schnorr>{{cite journal | last=Schnorr|first=Claus P.|year=1982|title=Refined analysis and improvements on some factoring algorithms|journal=Journal of Algorithms|volume=3|pages=101–127 | doi=10.1016/0196-6774(82)90012-8 | issue=2 | mr=0657269|url=http://www.dtic.mil/get-tr-doc/pdf?AD=ADA096348|archive-url=https://web.archive.org/web/20170924140543/http://www.dtic.mil/get-tr-doc/pdf?AD=ADA096348|url-status=dead|archive-date=September 24, 2017}}</ref> Seysen,<ref name=1987-seysen>{{cite journal| last=Seysen|first=Martin|year=1987|title=A probabilistic factorization algorithm with quadratic forms of negative discriminant|journal=Mathematics of Computation|volume=48|pages=757–780| doi=10.1090/S0025-5718-1987-0878705-X| issue=178 | mr=0878705|doi-access=free}}</ref> and Lenstra,<ref name=1988-lenstra >{{cite journal|last=Lenstra|first=Arjen K|year=1988|title=Fast and rigorous factorization under the generalized Riemann hypothesis|journal=Indagationes Mathematicae|volume=50|issue=4|pages=443–454|doi=10.1016/S1385-7258(88)80022-2|url=https://infoscience.epfl.ch/record/164491/files/nscan9.PDF }}</ref> which they proved only assuming the unproved [[Generalizedgeneralized Riemann hypothesis|Generalized Riemann Hypothesis (GRH)]].
 
== Rigorous running time ==
The Schnorr–Seysen–Lenstra probabilistic algorithm has been rigorously proven by Lenstra and Pomerance<ref name=lenstra-pomerance/> to have expected running time <{{math|''L<sub>n</sub>L_n\left''[\tfrac12{{sfrac|1|2}}, 1+''o''(1)\right]</math>}} by replacing the GRH assumption with the use of multipliers.
The algorithm uses the [[Ideal class group|class group]] of positive binary [[quadratic form]]s of [[Discriminant of a quadratic form|discriminant]] {{math|Δ}} denoted by {{math|''G''<sub>Δ</sub>}}.
{{math|''G''<sub>Δ</sub>}} is the set of triples of integers {{math|(''a'', ''b'', ''c'')}} in which those integers are relative prime.
 
=== Schnorr–Seysen–Lenstra algorithm ===
Given an integer ''{{mvar|n''}} that will be factored, where ''{{mvar|n''}} is an odd positive integer greater than a certain constant. In this factoring algorithm the discriminant {{math|Δ}} is chosen as a multiple of ''{{mvar|n''}}, {{nowrapmath|1=Δ = −''dn''}}, where ''{{mvar|d''}} is some positive multiplier. The algorithm expects that for one ''{{mvar|d''}} there exist enough [[smooth number|smooth]] forms in {{math|''G''<sub>Δ</sub>}}. Lenstra and Pomerance show that the choice of ''{{mvar|d''}} can be restricted to a small set to guarantee the smoothness result.
 
Denote by ''P''<sub>Δ</sub> the set of all primes ''q'' with [[Kronecker symbol]] <math>\left(\tfrac{\Delta}{q}\right)=1</math>. By constructing a set of [[Generating set of a group|generators]] of ''G''<sub>Δ</sub> and prime forms ''f''<sub>''q''</sub> of ''G''<sub>Δ</sub> with ''q'' in ''P''<sub>Δ</sub> a sequence of relations between the set of generators and ''f''<sub>''q''</sub> are produced.
The size of ''q'' can be bounded by ''c''<sub>0</sub>(log{{abs|Δ}})<sup>2</sup> for some constant ''c''<sub>0</sub>.
 
Denote by {{math|''P''<sub>Δ</sub>}} the set of all primes ''{{mvar|q''}} with [[Kronecker symbol]] <{{math>\left(\tfrac|{\Delta}{pars|s=150%|{{sfrac|Δ|''q''}\right)}}} {{=}} 1</math>}}. By constructing a set of [[Generating set of a group|generators]] of {{math|''G''<sub>Δ</sub>}} and prime forms {{math|''f''<sub>''q''</sub>}} of {{math|''G''<sub>Δ</sub>}} with ''{{mvar|q''}} in {{math|''P''<sub>Δ</sub>}} a sequence of relations between the set of generators and {{math|''f''<sub>''q''</sub>}} are produced.
The relation that will be used is a relation between the product of powers that is equal to the [[group (mathematics)|neutral element]] of ''G''<sub>Δ</sub>. These relations will be used to construct a so-called ambiguous form of ''G''<sub>Δ</sub>, which is an element of ''G''<sub>Δ</sub> of order dividing 2. By calculating the corresponding factorization of Δ and by taking a [[Greatest common divisor|gcd]], this ambiguous form provides the complete prime factorization of ''n''. This algorithm has these main steps:
The size of ''{{mvar|q''}} can be bounded by {{math|''c''<sub>0</sub>(log{{abs|Δ}})<sup>2</sup>}} for some constant {{math|''c''<sub>0</sub>}}.
 
The relation that will be used is a relation between the product of powers that is equal to the [[group (mathematics)|neutral element]] of {{math|''G''<sub>Δ</sub>}}. These relations will be used to construct a so-called ambiguous form of {{math|''G''<sub>Δ</sub>}}, which is an element of {{math|''G''<sub>Δ</sub>}} of order dividing 2. By calculating the corresponding factorization of {{math|Δ}} and by taking a [[Greatest common divisor|gcd]], this ambiguous form provides the complete prime factorization of ''{{mvar|n''}}. This algorithm has these main steps:
Let ''n'' be the number to be factored.
# Let Δ be a negative integer with {{nowrap|1=Δ = −''dn''}}, where ''d'' is a multiplier and Δ is the negative discriminant of some quadratic form.
# Take the ''t'' first primes ''p''<sub>1</sub> = 2, ''p''<sub>2</sub> = 3, ''p''<sub>3</sub> = 5, ..., ''p''<sub>''t''</sub>, for some {{nowrap|''t'' ∈ '''N'''}}.
# Let ''f''<sub>''q''</sub> be a random prime form of ''G''<sub>Δ</sub> with <math display="inline">\left(\frac{\Delta}{q}\right) = 1</math>.
# Find a generating set ''X'' of ''G''<sub>Δ</sub>.
# Collect a sequence of relations between set ''X'' and {{nowrap|{{mset|''f''<sub>''q''</sub> : ''q'' ∈ ''P''<sub>Δ</sub>}}}} satisfying: <math display="inline">\left(\prod_{x \in X_{}} x^{r(x)}\right).\left(\prod_{q \in P_\Delta} f^{t(q)}_{q}\right) = 1</math>.
# Construct an ambiguous form {{nowrap|(''a'', ''b'', ''c'')}} that is an element {{nowrap|''f'' ∈ ''G''<sub>Δ</sub>}} of order dividing 2 to obtain a coprime factorization of the largest odd divisor of Δ in which {{nowrap|1=Δ = −4''ac''}} or {{nowrap|1=Δ = ''a''(''a'' − 4''c'')}} or {{nowrap|1=Δ = (''b'' − 2''a'')(''b'' + 2''a'')}}.
# If the ambiguous form provides a factorization of ''n'' then stop, otherwise find another ambiguous form until the factorization of ''n'' is found. In order to prevent useless ambiguous forms from generating, build up the [[Sylow theorems|2-Sylow]] group Sll<sub>2</sub>(Δ) of ''G''(Δ).
 
Let ''{{mvar|n''}} be the number to be factored.
{{ordered list
#| Let {{math|Δ}} be a negative integer with {{nowrapmath|1=Δ = −''dn''}}, where ''{{mvar|d''}} is a multiplier and {{math|Δ}} is the negative discriminant of some quadratic form.
#| Take the ''{{mvar|t''}} first primes {{math|''p''<sub>1</sub> {{=}} 2, ''p''<sub>2</sub> {{=}} 3, ''p''<sub>3</sub> {{=}} 5, ..., ''p''<sub>''t''</sub>}}, for some {{nowrapmath|''t'' ∈ '''N'''}}.
#| Let {{math|''f''<sub>''q''</sub>}} be a random prime form of {{math|''G''<sub>Δ</sub>}} with <{{math display|{{pars|s="inline">\left(\frac150%|{\Delta}{sfrac|Δ|''q''}}}}\right) {{=}} 1</math>}}.
#| Find a generating set ''{{mvar|X''}} of {{math|''G''<sub>Δ</sub>}}.
#| Collect a sequence of relations between set ''{{mvar|X''}} and {{nowrapmath|{{mset|''f''<sub>''q''</sub> : ''q'' ∈ ''P''<sub>Δ</sub>}}}} satisfying: <math display="inline">\left(\prod_{x \in X_{}} x^{r(x)}\right).\left(\prod_{q \in P_\Delta} f^{t(q)}_{q}\right) = 1</math>.
: <math>\left(\prod_{x \in X_{}} x^{r(x)}\right).\left(\prod_{q \in P_\Delta} f^{t(q)}_{q}\right) = 1.</math>
#| Construct an ambiguous form {{nowrapmath|(''a'', ''b'', ''c'')}} that is an element {{nowrapmath|''f'' ∈ ''G''<sub>Δ</sub>}} of order dividing 2 to obtain a coprime factorization of the largest odd divisor of {{math|Δ}} in which {{nowrapmath|1=Δ = −4''ac''}} or {{nowrapmath|1=Δ = ''a''(''a'' − 4''c'')}} or {{nowrapmath|1=Δ = (''b'' − 2''a'')(''b'' + 2''a'')}}.
#| If the ambiguous form provides a factorization of ''{{mvar|n''}} then stop, otherwise find another ambiguous form until the factorization of ''{{mvar|n''}} is found. In order to prevent useless ambiguous forms from generating, build up the [[Sylow theorems|2-Sylow]] group {{math|Sll<sub>2</sub>(Δ)}} of {{math|''G''(Δ)}}.
}}
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 [[Adleman–Pomerance–Rumely primality test|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 <{{math|''L<sub>n</sub>L_n\left''[\tfrac12{{sfrac|1|2}}, 1+''o''(1)\right]</math>}}.<ref name=lenstra-pomerance>{{cite journal | first1=H. W. |last1=Lenstra|first2=Carl|last2= Pomerance |date=July 1992 |title=A Rigorous Time Bound for Factoring Integers |journal=Journal of the American Mathematical Society |volume=5 |pages=483–516|url=https://www.ams.org/journals/jams/1992-05-03/S0894-0347-1992-1137100-0/S0894-0347-1992-1137100-0.pdf | doi=10.1090/S0894-0347-1992-1137100-0 | issue=3 | mr=1137100|doi-access=free }}</ref>
 
== See also ==
Line 140 ⟶ 172:
* [[Factorization]]
* [[Multiplicative partition]]
* [[p-adic valuation|<math>{{mvar|p</math>}}-adic valuation]]
* [[PartitionInteger (number theory)partition]] – a way of writing a number as a sum of positive integers.
 
== Notes ==
Line 158 ⟶ 190:
 
== External links ==
* [httphttps://sourceforge.net/projects/msieve/ msieve] – SIQS and NFS – has helped complete some of the largest public factorizations known
* Richard P. Brent, "Recent Progress and Prospects for Integer Factorisation Algorithms", ''Computing and Combinatorics"'', 2000, pp.&nbsp;3–22. [http://citeseer.ist.psu.edu/327036.html download]
* [[Manindra Agrawal]], Neeraj Kayal, Nitin Saxena, "PRIMES is in P." Annals of Mathematics 160(2): 781–793 (2004). [http://www.cse.iitk.ac.in/users/manindra/algebra/primality_v6.pdf August 2005 version PDF]