Prime factorisation
Break a whole number into primes. There is exactly one answer, which makes this the rarest thing on this site: a calculation with nothing to disown. Nothing you type here leaves your browser — it is worked out on your own device, so there is nothing to send and nothing to log.
There is exactly one answer, and this is it
Every whole number above 1 is a product of primes in exactly one way. Not “usually”, not “up to rearrangement of the interesting cases” — one way, always. That is the fundamental theorem of arithmetic, and it is why this page has nothing to disown: there is no rounding, no convention and no choice. 360 is 23 × 32 × 5 and it cannot be anything else.
1 is not prime, and it is not composite either
This trips everybody, and the reason is the theorem above. If 1 counted as prime then 6 would be 2 × 3, and 1 × 2 × 3, and 1 × 1 × 2 × 3, and the “exactly one way” would be false. So 1 is left out by definition, and it has no prime factorisation at all — not an empty one by accident, but by design.
Why the powers matter
Written as powers, the factorisation answers other questions immediately. A number that is pa × qb has exactly (a+1)(b+1) divisors, because each divisor picks a power of each prime independently. 360 = 23 × 32 × 51 therefore has 4 × 3 × 2 = 24 divisors, and you never have to look for them.
How it is worked out
Trial division, which is more than enough here. Divide by 2 as often as it goes, then by 3, 5, 7 and every odd number after, stopping at the square root — because a factor above the square root would have had a partner below it, and that partner would already have been found. Whatever is left when the loop ends is itself prime.
What it will not do
- It will not factorise numbers above 9,007,199,254,740,991, which is the largest whole number a browser can hold without losing digits. Past there the number you typed is not the number being worked on.
- It will not be fast on a large semiprime. Trial division is honest and simple; factorising a 40-digit product of two primes is the thing modern cryptography is built on being hard.
- It will not factorise fractions or negatives. The factorisation of −12 is the factorisation of 12 with a minus sign, so the sign is dropped and said so.