In number theory, integer factorization or prime factorization is the breaking down of a composite number into smaller nontrivial divisors, which when multiplied together equal the original integer.
When the numbers are very large, no efficient integer factorization algorithm is publicly known; an effort concluded 2010 by several researchers factored a 232digit number (RSA768) utilizing hundreds of machines over a span of 2 years.^{[1]} The presumed difficulty of this problem is at the heart of certain algorithms in cryptography such as RSA. 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, randomly chosen, and about the same size (but not too close), even the fastest prime factorization algorithms on the fastest computers can take enough time to make the search impractical.
Many cryptographic protocols are based on the difficultly of factoring large composite integers or a related problem, the RSA problem. An algorithm which efficiently factors an arbitrary integer would render RSAbased publickey cryptography insecure.
Contents 
By the fundamental theorem of arithmetic, every positive integer has a unique prime factorization. (A special case for 1 is not needed using an appropriate notion of the empty product.) However, the fundamental theorem of arithmetic gives no insight into how to obtain an integer's prime factorization; it only guarantees its existence.
Given an algorithm for integer factorization, one can factor any integer down to its constituent prime factors by repeated application of this algorithm.
A team at the German Federal Agency for Information Technology Security (BSI) holds the record for factorization of semiprimes in the series proposed by the RSA Factoring Challenge sponsored by RSA Security. On May 9, 2005, this team announced factorization of RSA200, a 663bit number (200 decimal digits), using the general number field sieve.
The same team later announced factorization of RSA640, a smaller, 640bit number (193 decimal digits), on November 4, 2005.
Both factorizations required several months of computer time using the combined power of 80 AMD Opteron CPUs.
In January 2010, the factorization of RSA768 was announced.^{[2]}
If a large, bbit number is the product of two primes that are roughly the same size, then no algorithm has been published that can factor in polynomial time, i.e., that can factor it in time O(b^{k}) for some constant k. There are published algorithms that are faster than O((1+ε)^{b}) for all positive ε, i.e., subexponential.
The best published asymptotic running time is for the general number field sieve (GNFS) algorithm, which, for a bbit number n, is:
For an ordinary computer, GNFS is the best published algorithm for large n (more than about 100 digits). For a quantum computer, however, Peter Shor discovered an algorithm in 1994 that solves it in polynomial time. This will have significant implications for cryptography if a large quantum computer is ever built. Shor's algorithm takes only O(b^{3}) time and O(b) space on bbit number inputs. In 2001, the first 7qubit quantum computer became the first to run Shor's algorithm. It factored the number 15.
When discussing what complexity classes the integer factorization problem falls into, it's necessary to distinguish two slightly different versions of the problem:
It is not known exactly which complexity classes contain the decision version of the integer factorization problem. It is known to be in both NP and coNP. This is because both YES and NO answers can be trivially verified given the prime factors (we can verify their primality using the AKS primality test, and that their product is N by multiplication). In fact, providing we require the factors to be listed in order, the fundamental theorem of arithmetic will guarantee that there is only one possible string that will be accepted; this shows that the problem is in both UP and coUP.^{[3]} It is known to be in BQP because of Shor's algorithm. It is suspected to be outside of all three of the complexity classes P, NPcomplete, and coNPcomplete. If it could be proved that it is in either NPComplete or coNPComplete, that would imply NP = coNP. That would be a very surprising result, and therefore integer factorization is widely suspected to be outside both of those classes. Many people have tried to find classical polynomialtime algorithms for it and failed, and therefore it is widely suspected to be outside P.
In contrast, the decision problem "is N a composite number?" (or equivalently: "is N a prime number?") appears to be much easier than the problem of actually finding the factors of N. Specifically, the former can be solved in polynomial time (in the number n of digits of N) with the AKS primality test. In addition, there are a number of probabilistic algorithms that can test primality very quickly in practice if one is willing to accept the 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.
A specialpurpose factoring algorithm's running time depends on the properties of its unknown factors: size, special form, etc. Exactly what the running time depends on varies between algorithms. For example, trial division is considered special purpose because the running time is roughly proportional to the size of the smallest factor.
A generalpurpose factoring algorithm's running time depends solely on the size of the integer to be factored. This is the type of algorithm used to factor RSA numbers. Most generalpurpose factoring algorithms are based on the congruence of squares method.

