The fundamental theorem of arithmetic
Every integer greater than 1 has a unique prime factorisation (up to ordering of the factors). That uniqueness is what makes prime factorisation the canonical "fingerprint" of a number.
From the prime factorisation you can immediately read off:
- The total number of divisors: σ0(n) = Π(ei + 1).
- The sum of all divisors: σ1(n) = Π((piei+1 − 1)/(pi − 1)).
- Whether n is a perfect square (every ei even) or a prime (one factor with exponent 1).
FAQ
Why isn't 1 included in the factorisation?
By convention 1 is not prime, and including it wouldn't add anything useful — multiplying by 1 leaves the number unchanged. Excluding 1 keeps factorisations unique.
How big can the input be?
Trial division is fast for numbers up to about 10¹². Beyond that, runtime grows; for very large numbers use a dedicated cryptographic factoriser.
What if the number is prime?
The factorisation is just the number itself. The "Is prime?" row shows "Yes" and the divisor count is 2 (1 and the number).