Most factorization algorithms in use today fit in one of two camps: sieve-based methods based on congruences of squares, and algorithms based on decompositions of algebraic groups. In this article, we trace the common thread connecting the latter.
Classification theorems of Euler, Lagrange, and Legendre describe the sets of integers that can be written as the sum of 2, 3, and 4 squares. In the last two cases, it follows easily that the density of these sets are 5/6 and 1.
The question of density is not so simple in the case of two squares. In this post, we resolve using an unexpected tool — Dirichlet’s theorem on primes in arithmetic progressions.