It answers the counting and divisibility questions of school and university maths exactly, with whole numbers of any length (BigInt arithmetic, no rounding). Three tabs:
- Counting: n!, permutations nPr, combinations nCr, the versions with repetition (nʳ and C(n + r − 1, r)), the Catalan number Cₙ, the Fibonacci number Fₙ and the Stirling numbers S(n, k) and c(n, k). Long results show their digit count and copy in full.
- Primes and factors: whether a number is prime, its prime factorisation, Euler's φ(n), the number and sum of its divisors and the list of divisors, plus all primes in a range.
- GCD and modular: greatest common divisor and least common multiple, the Bézout coefficients with every step of the extended Euclidean algorithm, a modular power aᵉ mod m and a modular inverse.
Permutations or combinations?
Ask two questions: does order matter, and can an item be chosen again?
| No repetition | With repetition |
|---|
| Order matters | nPr = n!/(n − r)! | nʳ |
|---|
| Order does not matter | nCr = n!/(r!(n − r)!) | C(n + r − 1, r) |
|---|
Gold, silver and bronze among 8 runners: order matters, nobody wins twice, so 8P3 = 336. Three different toppings out of 10: order does not matter, C(10, 3) = 120; if double cheese is allowed, C(12, 3) = 220. A 4-letter code from 26 letters with repeats allowed: 26⁴ = 456,976. A Mega 6/45 lottery ticket: C(45, 6) = 8,145,060 possible draws.
Catalan numbers count balanced bracket strings, binary trees and many other structures (C₁₀ = 16,796). Stirling numbers of the second kind count the ways to split n labelled items into k non-empty groups: 10 people into 3 teams can be split S(10, 3) = 9,330 ways (ignoring team names). Stirling numbers of the first kind count permutations by their number of cycles.
Primes: what "prime" and "probable prime" mean here
Small numbers are proved prime by trial division. Up to 3.3 × 10²⁴ the tool runs Miller–Rabin with the 13 prime bases up to 41, which is a proof in that range (Sorenson and Webster, 2015): strong pseudoprimes such as 3,215,031,751 (which fools bases 2, 3, 5 and 7) are caught. Above that it uses the Baillie–PSW test, Miller–Rabin base 2 plus a strong Lucas test. No composite number is known to pass it, but nobody has proved none exists, so the tool says probable prime. A "composite" verdict is always certain.
Factorisation and its limits
Factoring first divides out primes up to 10,000, then uses Pollard's rho (Brent's variant), which finds a factor p in roughly √p steps. That makes quick work of 600,851,475,143 = 71 × 839 × 1471 × 6857 or of Cole's famous 2⁶⁷ − 1 = 193,707,721 × 761,838,257,287. It stops after two seconds and shows what is left in brackets when the number is a product of two large primes, say two 20-digit primes. That is not a bug: multiplying primes is easy and undoing it is hard, and RSA encryption depends on that gap. Real RSA moduli have over 600 digits, far beyond any browser.
GCD, Bézout and modular inverses
The extended Euclidean table shows each quotient and remainder and the running coefficients. For 240 and 46: the remainders are 10, 6, 4, 2, 0, so the GCD is 2 and 240 × (−9) + 46 × 47 = 2. A modular inverse a⁻¹ mod m exists exactly when gcd(a, m) = 1: 3 × 4 = 12 ≡ 1 (mod 11), so 3⁻¹ mod 11 = 4. Modular powers use square-and-multiply, so 4¹³ mod 497 = 445 and even huge exponents are instant. For the intuition behind all this, read permutations vs combinations, and why factoring is hard; for statistics on your results, the statistics calculator is next door.