In
number theory
Number theory is a branch of pure mathematics devoted primarily to the study of the integers and arithmetic functions. Number theorists study prime numbers as well as the properties of mathematical objects constructed from integers (for example ...
, the general number field sieve (GNFS) is the most
efficient classical
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
known for
factoring integers larger than
.
Heuristic
A heuristic or heuristic technique (''problem solving'', '' mental shortcut'', ''rule of thumb'') is any approach to problem solving that employs a pragmatic method that is not fully optimized, perfected, or rationalized, but is nevertheless ...
ally, its
complexity
Complexity characterizes the behavior of a system or model whose components interact in multiple ways and follow local rules, leading to non-linearity, randomness, collective dynamics, hierarchy, and emergence.
The term is generally used to c ...
for factoring an integer (consisting of bits) is of the form
:
in
O and
L-notation
''L''-notation is an asymptotic notation analogous to big-O notation, denoted as L_n alpha,c/math> for a bound variable n tending to infinity. Like big-O notation, it is usually used to roughly convey the rate of growth of a function, such as the ...
s. It is a generalization of the
special number field sieve: while the latter can only factor numbers of a certain special form, the general number field sieve can factor any number apart from
prime power
In mathematics, a prime power is a positive integer which is a positive integer power of a single prime number.
For example: , and are prime powers, while
, and are not.
The sequence of prime powers begins:
2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 1 ...
s (which are trivial to factor by taking roots).
The principle of the number field sieve (both special and general) can be understood as an improvement to the simpler
rational sieve or
quadratic sieve. When using such algorithms to factor a large number , it is necessary to search for
smooth number
In number theory, an ''n''-smooth (or ''n''-friable) number is an integer whose prime factors are all less than or equal to ''n''. For example, a 7-smooth number is a number in which every prime factor is at most 7. Therefore, 49 = 72 and 15750 = 2 ...
s (i.e. numbers with small prime factors) of order . The size of these values is exponential in the size of (see below). The general number field sieve, on the other hand, manages to search for smooth numbers that are subexponential in the size of . Since these numbers are smaller, they are more likely to be smooth than the numbers inspected in previous algorithms. This is the key to the efficiency of the number field sieve. In order to achieve this speed-up, the number field sieve has to perform computations and factorizations in
number field
In mathematics, an algebraic number field (or simply number field) is an extension field K of the field of rational numbers such that the field extension K / \mathbb has finite degree (and hence is an algebraic field extension).
Thus K is a ...
s. This results in many rather complicated aspects of the algorithm, as compared to the simpler rational sieve.
The size of the input to the algorithm is or the number of bits in the binary representation of . Any element of the order for a constant is exponential in . The running time of the number field sieve is super-polynomial but sub-exponential in the size of the input.
Number fields
Suppose is a -degree polynomial over
(the rational numbers), and is a complex root of . Then, , which can be rearranged to express as a linear combination of powers of less than . This equation can be used to reduce away any powers of with exponent . For example, if and is the imaginary unit , then , or . This allows us to define the complex product:
:
In general, this leads directly to the
algebraic number field
In mathematics, an algebraic number field (or simply number field) is an extension field K of the field of rational numbers such that the field extension K / \mathbb has finite degree (and hence is an algebraic field extension).
Thus K is a ...