Dixon's factorization method
In number theory, Dixon's factorization method (also Dixon's random squares method or Dixon's algorithm) is a general-purpose integer factorization algorithm; it is the prototypical factor base method.[src] Unlike for other factor base methods, its run-time bound comes with a rigorous proof that does not rely on conjectures about the smoothness properties of the values taken by a polynomial.[src] The algorithm was designed by John D.[src] Dixon, a mathematician at Carleton University, and was published in 1981.[src]
In number theory, Dixon's factorization method (also Dixon's random squares method or Dixon's algorithm) is a general-purpose integer factorization algorithm; it is the prototypical factor base method.[src] Unlike for other factor base methods, its run-time bound comes with a rigorous proof that does not rely on conjectures about the smoothness properties of the values taken by a polynomial.[src] The algorithm was designed by John D.[src] Dixon, a mathematician at Carleton University, and was published in 1981.[src] ==Basic idea== Dixon's method is based on finding a congruence of squares modulo the integer N which is intended to factor.[src] We explain the basic idea here by first describing Fermat's factorization method, then how Dixon's method proceeds differently.[src] Fermat's factorization method finds such a congruence by selecting random or pseudo-random x values and hoping that the integer x 2 mod N is a nontrivial perfect square (in the integers): x^2\equiv y^2\quad(\hbox{mod }N),\qquad x\not\equiv\pm y\quad(\hbox{mod }N).[src] For example, if , (by starting at 292, the first number greater than and counting up) the is 256, the square of 16.[src] So .[src] Computing the greatest common divisor of and N using Euclid's algorithm gives 163, which is a factor of N.[src] In practice, selecting random x values will take an impractically long time to find a congruence of squares, since there are only squares less than N.[src] Dixon's method replaces the condition "is a nontrivial perfect square" with the much weaker one "has only small prime factors"; for example, there are 292 squares smaller than 84923; 662 numbers smaller than 84923 whose prime factors are only 2,3,5 or 7; and 4767 whose prime factors are all less than 30.[src] (Such numbers are called 7-smooth and 30-smooth, respectively, since they are B-smooth with respect to some bound B.) Once enough of these B-smooth values are found, linear algebra can be used to search for nontrivial perfect squares for Fermat's factorization method.[src] If there are many numbers a_1 \ldots a_n whose squares can be factorized as a_i^2 \mod N = \prod_{j=1}^m b_j^{e_{ij}} for a fixed set b_1 \ldots b_m of small primes, linear algebra modulo 2 on the matrix e_{ij} will give a subset of the a_i whose squares combine to a product of small primes to an even power — that is, a subset of the a_i whose squares multiply to the square of a (hopefully different) number mod N.[src] ==Method== Suppose the composite number N is being factored.[src] Bound B is chosen, and the factor base is identified (which is called P), the set of all primes less than or equal to B.[src] Next, positive integers z are sought such that z 2 mod N is B-smooth.[src] Therefore we can write, for suitable exponents a i , z^2 \text{ mod } N = \prod_{p_i\in P} p_i^{a_i} When enough of these relations have been generated (it is generally sufficient that the number of relations be a few more than the size of P), the methods of linear algebra, such as Gaussian elimination, can be used to multiply together these various relations in such a way that the exponents of the primes on the right-hand side are all even: {z_1^2 z_2^2 \cdots z_k^2 \equiv \prod_{p_i\in P} p_i^{a_{i,1}+a_{i,2}+\cdots+a_{i,k}}\ \pmod{N}\quad (\text{where } a_{i,1}+a_{i,2}+\cdots+a_{i,k} \equiv 0\pmod{2}) } This yields a congruence of squares of the form which can be turned into a factorization of N, This factorization might turn out to be trivial (i.e.[src] ), which can only happen if in which case another try must be made with a different combination of relations; but if a nontrivial pair of factors of N is reached, the algorithm terminates.[src] ==Pseudocode== This section is taken directly from Dixon (1981).[src] Dixon's algorithm Initialization.[src] Let L be a list of integers in the range [1, n], and let P = {p 1 , ..., p h } be the list of the h primes ≤ v.[src] Let B and Z be initially empty lists (Z will be indexed by B).[src] Step 1.[src] If L is empty, exit (algorithm unsuccessful).[src] Otherwise, take the first term z from L, remove it from L, and proceed to Step 2.[src] Step 2.[src] Compute w as the least positive remainder of z 2 mod n.[src] Factor w as: w = w' \prod_i p_i^{a_i} where has no factor in P.[src] If = 1, proceed to Step 3; otherwise, return to Step 1.[src] Step 3.[src] Let a ← (a 1 , ..., a h ).[src] Add a to B and z to Z.[src] If B has at most h elements, return to Step 1; otherwise, proceed to Step 4.[src] Step 4.[src] Find the first vector c in B that is linearly dependent (mod 2) on earlier vectors in B.[src] Remove c from B and z_c from Z.[src] Compute coefficients f_b such that: \mathbf{c} \equiv \sum_{b \in B} f_b \mathbf{b} \pmod{2} Define: \mathbf{d} = (d_1, \dots, d_n) \gets \frac{1}{2} \left(\mathbf{c} + \sum f_b \mathbf{b} \right) Proceed to Step 5.[src] Step 5.[src] Compute: x \gets z_c \prod_b z_b^{f_b}, \quad y \gets \prod_i p_i^{d_i} so that: x^2 \equiv \prod_i p_i^{2d_i} = y^2 \mod n.[src] If x \equiv y or x \equiv -y \pmod{n} , return to Step 1.[src] Otherwise, return: \gcd(n, x + y) which provides a nontrivial factor of n, and terminate successfully.[src] In this example, we factorize (n = 84923) using Dixon's algorithm.[src] This example is lightly adapted from the LeetArxiv substack.[src] Credit is given to the original author.[src] Initialization: Define a list of numbers L, ranging from 1 to 84923: L = \{1, \dots, 84923\} Define a value v, which is the smoothness factor: v = 7 Define a list P containing all the prime numbers less than or equal to v: P = {2, 3, 5, 7} Define B and Z, two empty lists.[src] B is a list of powers, while Z is a list of accepted integers: B = [ ] Z = [ ] Step 1: Iterating z values Start a for loop that indexes the list L .[src] The current element in L is labeled as z .[src] The for loop exits at the end of the list, or when Step 5 breaks the loop.[src] int n = 84923; for (int i = 1; i Step 2: Computing z^2 \mod n and v-smooth Prime Factorization To proceed, compute z^2 \mod 84923 for each z, then express the result as a prime factorization.[src] 1^2 \mod 84923 \equiv 1 \mod 84923 = 2^0 \cdot 3^0 \cdot 5^0 \cdot 7^0 \mod 84923 \vdots 513^2 \mod 84923 = 8400 \mod 84923 = 2^4 \cdot 3^1 \cdot 5^2 \cdot 7^1 \mod 84923 \vdots 537^2 \mod 84923 = 33600 \mod 84923 = 2^6 \cdot 3^1 \cdot 5^2 \cdot 7^1 \mod 84923 538^2 \mod 84923 = 34675 \mod 84923 = 5^2 \cdot 19^1 \cdot 73^1 \mod 84923 This step continues for all values of z in the range.[src] Step 3: Appending v-smooth results If z^2 \mod 84923 is 7-smooth, then append its powers to list B and append z to list Z .[src] If B has at most h=4 elements, return to Step 1.[src] Otherwise, proceed to Step 4.[src] For example, after 537 iterations, we have: Z = \{1, \ldots, 513, 537\} B = \{ [0, 0, 0, 0], \ldots, [4, 1, 2, 1], [6, 1, 2, 1] \} and we proceed on to Step 4 since we would have more than h=4 vectors in B .[src] Step 4: This step is split into two parts.[src] Part 1: Finding B modulo 2 B = \begin{pmatrix} 0 & 0 & 0 & 0 \\ 4 & 1 & 2 & 1 \\ 6 & 1 & 2 & 1 \end{pmatrix} \mod 2 \equiv B = \begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 1 \end{pmatrix} Part 2: Finding a row combination of B that sums to even numbers For example, summing Row 2 and Row 3 gives us a vector of even numbers.[src] R_2 = \{0, 1, 0, 1\} and R_3 = \{0, 1, 0, 1\} then R_2 + R_3 = \{0, 1, 0, 1\} + \{0, 1, 0, 1\} R_2 + R_3 = \{0, 2, 0, 2\} .[src] Step 5: This step is split into four parts.[src] Part 1: Computing x Multiply the corresponding z values for the rows found in Step 4, mod n to get x .[src] Rows 2 and 3 correspond with 513 and 537, so x = (513 \cdot 537) = 20712 \mod 84923 Part 2: Computing y Add the rows found in Step 4.[src] Divide by 2.[src] (Since these represent exponents, this effectively takes a square root.) Apply as exponents to the primes in P to get y .[src] Return to Step 1 if x = \pm y .[src] Find the half the sum of Rows 2 and 3: \begin{array}{ccccc} & 4 & 1 & 2 & 1 \\ + & 6 & 1 & 2 & 1 \\\hline & 10 & 2 & 4 & 2 \\ \div2 \\\hline & 5 & 1 & 2 & 1 \end{array} Apply those as exponents to P=\{2,3,5,7\} : y = 2^5 \cdot 3^1 \cdot 5^2 \cdot 7^1 = 16800 Since x \ne \pm y , we proceed to Part 3.[src] Part 3: Computing x + y and x - y where x = 20712 and y = 16800 x + y = 20712 + 16800 = 37512 x - y = 20712 - 16800 = 3912 Part 4: Computing \gcd(x+y, n) and \gcd(x-y, n) where n = 84923 , x+y = 292281 and x-y = 258681 \begin{array}{ll} \gcd(37512, 84923) = 521 \\ \gcd(3912, 84923) = 163 \end{array} Quick check shows 84923 = 521 \cdot 163 .[src] The pseudocode says to only calculate x+y and return \gcd(x+y, n) .[src] This is because it is the faster GCD to compute, and once you have it, dividing n by the result is faster than computing \gcd(x-y, n) .[src] ==Optimizations== The quadratic sieve is an optimization of Dixon's method.[src] It selects values of x close to the square root of such that x 2 modulo N is small, thereby largely increasing the chance of obtaining a smooth number.[src] Other ways to optimize Dixon's method include using a better algorithm to solve the matrix equation, taking advantage of the sparsity of the matrix: a number z cannot have more than \log_2 z factors, so each row of the matrix is almost all zeros.[src] In practice, the block Lanczos algorithm is often used.[src] Also, the size of the factor base must be chosen carefully: if it is too small, it will be difficult to find numbers that factorize completely over it, and if it is too large, more relations will have to be collected.[src] A more sophisticated analysis, using the approximation that a number has all its prime factors less than N^{1/a} with probability about a^{-a} (an approximation to the Dickman–de Bruijn function), indicates that choosing too small a factor base is much worse than too large, and that the ideal factor base size is some power of \exp\left(\sqrt{\log N \log \log N}\right) .[src] The optimal complexity of Dixon's method is O\left(\exp\left(2 \sqrt 2 \sqrt{\log n \log \log n}\right)\right) in big-O notation, or L_n [1/2, 2 \sqrt 2] in L-notation.[src] ==References==[src]
80 sentences · 80 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Dixon's factorization method." encyclopegia.org, 2026, https://encyclopegia.org/wiki/dixon-s-factorization-method. Accessed 04 December 2026.
Chicago
"Dixon's factorization method." encyclopegia.org. Accessed December 4, 2026. https://encyclopegia.org/wiki/dixon-s-factorization-method.
APA
encyclopegia.org. (2026). Dixon's factorization method. Retrieved December 4, 2026, from https://encyclopegia.org/wiki/dixon-s-factorization-method
Accessed December 4, 2026 · CC BY-SA 4.0 · citation page · JSON
Claims
| Predicate | Value | Source |
|---|---|---|
| publication date | 1981 | Wikipedia |