Math calculators

Primes, factors, GCD and LCM

Free prime number checker and factorisation calculator, with divisors, next and previous prime, and GCD and LCM of a list of integers.

Inputs

Results

Methodology

Conventions

  • Primality uses a deterministic Miller–Rabin test, exact for every n in range (1 to 10¹⁵).
  • Factorisation is by trial division by 2, 3 and numbers of the form 6k ± 1.

References

  • Crandall and Pomerance, Prime Numbers: A Computational Perspective (2005)

Formulas

Factorisation
n = \prod p_i^{e_i}
Number of divisors
d(n) = \prod (e_i + 1)
Sum of divisors
\sigma(n) = \prod \frac{p_i^{e_i + 1} - 1}{p_i - 1}
LCM
\operatorname{lcm}(a, b) = \frac{|ab|}{\gcd(a, b)}