Fundamental Theorem of Arithmetic

The fundamental theory of arithmetic states that every number greater than 1 is either a prime number or composed by a unique product of prime numbers.

Examples

Shown below are the prime factorization of the numbers 2 up until 10. Each number is decomposed into its prime factorization, demonstrating the fundamental theorem of arithmetic. If the number is prime, then its prime factorization consists of only itself. Otherwise, the number is composed by a unique set of prime numbers.

Prime Factorization Tree

The prime factorization of larger numbers can be vizualized by the following tree structure. At each step, the input number is decomposed into the lowest prime factor and its corresponding factor. The leaves of the tree highlight the resulting prime factorization, which when multiplied together, equal the original number.

Input is limited to numbers in the range from 2 to 1 million. The arrow keys (up/down) can be used to increase or decrease the input number by 1.