calculate.sh DE

This tool runs in your browser using JavaScript. If it does not appear, please enable JavaScript or reload the page. The description below explains how it works.

Prime Factorization

Break any whole number into its prime building blocks. Every integer greater than one is either a prime number or a unique product of primes — the fundamental theorem of arithmetic. This tool finds that unique decomposition, tells you immediately whether your number is prime, and shows how many divisors it has. Useful for number puzzles, preparing crypto-notation examples, simplifying root expressions, or just understanding why 60 behaves the way it does (2² × 3 × 5).

How to use

  1. Type a whole number between 1 and 9,007,199,254,740,991 (the largest integer JavaScript can represent exactly).
  2. The factorization appears instantly as prime powers — "2² × 5²" — with a Prime badge when the input is itself a prime.
  3. The divisor count below tells you how many positive integers divide the number evenly.

Try 100 and you get 2² × 5², try 97 and the badge lights up — 97 has no factors other than 1 and itself. The exponent notation keeps even huge numbers readable: 1,000,000 collapses to 2⁶ × 5⁶.

Prime powers in practice

The notation groups repeated factors: 360 = 2³ × 3² × 5 instead of a wall of "2 × 2 × 2 × 3 × 3 × 5". Raising primes to exponents also makes properties obvious. To count the divisors, take each exponent, add one, and multiply: 2³ × 3² × 5 gives (3+1)(2+1)(1+1) = 24 divisors. The tool shows this number for every input — a favorite of puzzle solvers and math teachers generating exercises.

How the algorithm works

The calculator uses trial division with a small optimization: candidate factors 2 and 3 are tested first, then every number of the form 6k ± 1. Since every composite number has a factor at most the size of its square root, the search stops there. For a number like 2,147,483,647 — a famous Mersenne prime of the form 2³¹ − 1 — the tool confirms primality in the blink of an eye. Inputs that are themselves prime are the slowest case for trial division, and a prime close to the upper safe-integer limit may take a moment; the result is still deterministic and exact, because all arithmetic stays within JavaScript's exact-integer range.

Why prime factorization matters

  • Cryptography intuition: RSA rests on the difficulty of factoring huge composites. Seeing 61 × 53 build 3,233 makes the direction of the trapdoor feel tangible.
  • Fractions and roots: canceling a fraction or simplifying √360 becomes trivial once the prime powers are on paper.
  • Number theory puzzles: divisors, perfect numbers, and GCD exercises all start from the same decomposition.
  • Random table games: some dice-based RPG mechanics literally ask for the prime factors of a card's number.

Boundary cases

The number 1 is special: it has no prime factors and is deliberately not classified as prime, so the tool reports one divisor and an empty factorization ("1"). Negative numbers and non-integers are rejected with a clear message — factorization is defined for positive integers only. Values above the safe-integer ceiling are also rejected, because beyond that point JavaScript can no longer represent every integer exactly and a "precise" answer would quietly be a lie.

Why it lives on this site

Prime Factorization sits in the Math category alongside the Number Base Converter and the BMR-free pure-number tools. It is entirely client-side: the computation happens in your browser, nothing is transmitted, and the page works offline. Paste a number, read the decomposition, copy it, and move on — no account required, no data stored.