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.

Explore more tools