- Home
- Units & math
- Primes, GCD, and LCM
Primes, GCD, and LCM
Check if a number is prime, split it into factors, and find the GCD or LCM.
Runs here in the tab · deterministic Miller-Rabin under ~3.3e24
Enter a number and press Run.
- Primality: trial division, then Miller-Rabin. Below ~3.3×10²⁴ the base set is deterministic, the answer is a fact. Above it, 40 random rounds run and the answer says probable prime, because that is what it is.
- Factorization: trial division, then Pollard's rho with a hard cap of 200,000 rounds. A number the cap cannot crack (typically a product of two large primes) refuses with the cap named. A wrong factor list would be worse. Every completed list is verified by multiplying back.
- Ranges sieve exactly (width ≤ 1,000,000); gcd/lcm are exact BigInt Euclid; lcm refuses a zero operand (meaningless by convention).
- Operands are digit strings up to 40 digits. Large work: sieves and factorizations past 10¹⁵, runs in the math family worker.