Table of Contents

Mathematics - (Prime Factorization Theorem | Factoring integers)

About

For every integer N >= 1, there is a unique bag of prime numbers whose product is N.

All the elements in a bag must be prime. If N is itself prime, the bag for N is just {N}.

The problem of distinguishing prime numbers from composite numbers and of resolving the latter into their prime factors is known to be one of the most important and useful in arithmetic.

Carl Friedrich Gauss, Disquisitiones Arithmeticae, 1801

Because both the system’s privacy and the security of digital money depend on encryption, a breakthrough in mathematics or computer science that defeats the cryptographic system could be a disaster. The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers.

Bill Gates, The Road Ahead, 1995

Example

Use

Secure Sockets Layer

Secure communication with websites uses HTTPS (Secure HTTP)

Computation

Naive way

# Python
def factor(N):
    for d in range(2, N-1):
        if N % d == 0: return d

As:

it suffices to search form 2 to <math>\sqrt{N}</math>

# Python
def factor(N):
    for d in range(2, intsqrt(N):
        if N % d == 0: return d

Using square roots

Definition

Find integers a and b such that: <MATH>a^2 − b^2 = N</MATH> Then: <MATH>(a − b)(a + b) = N</MATH> so a − b and a + b are divisors ideally non-trivial

Computation

Naive approach to find such integers:

For large N, it takes too long to find a good integer a