Prime Number Checker & Prime Factorization

Enter an integer to check if it’s prime and see its prime factorization. 100% client-side.

Input & Actions

Tip: accepts integers like 84, -210, or big integers (within reason). Decimals are not supported.

Results will appear here.

Method & Definitions

This tool determines whether a number is prime and computes its prime factorization. It uses optimized trial division up to \( \sqrt{n} \), checking 2, 3, and then only candidates of the form \( 6k \pm 1 \).

  • Prime: \(n>1\) with no divisors other than 1 and \(n\).
  • Composite: \(n>1\) that is not prime.
  • Prime factorization: \( n = \prod p_i^{e_i} \).
\( \text{Prime test: } \nexists d \in \{2,\dots,\lfloor\sqrt{n}\rfloor\} \text{ with } n \bmod d = 0 \)
\( \text{Factorization: } n = \prod p_i^{e_i}, \; e_i \in \mathbb{Z}_{\ge 0} \)

FAQ

Is 1 prime?

No. By definition, primes are integers \(\ge 2\).

How are negatives handled?

We display \( -1 \times \) the factorization of \(|n|\). Example: \(-84 = -1 \times 2^2 \times 3 \times 7\).

Performance limits?

Trial division up to \( \sqrt{n} \) is quick for typical classroom sizes (up to ~1010 is usually fine in modern browsers). Extremely large inputs will take longer.

5 Fun Facts about Primes

1 is not prime

We keep 1 out of the prime club so every integer >1 has a unique prime factorization (the Fundamental Theorem of Arithmetic).

Definition choice

2 is the only even prime

Every other even number has 2 as a factor, so 2 stands alone—making it both the smallest prime and the loneliest even one.

Even unicorn

Gaps can be huge

Primes get rarer but never stop. There are arbitrarily long stretches of composites—yet another prime always appears eventually.

Prime deserts

6k ± 1 shortcut

Every prime greater than 3 is of the form \(6k \pm 1\). That’s why this tool skips other residues when it searches.

Search trick

RSA leans on factoring

Modern encryption relies on the difficulty of factoring huge semiprimes. Fast factoring breaks keys—hence the race for quantum-safe crypto.

Crypto link

Explore more tools