CipherMatrix

Number Theory Calculators

Number theory studies the integers: divisibility, primes, congruences and the structure of the integers modulo n. It is also the mathematical foundation of public-key cryptography, so the same ideas appear in algebra, discrete mathematics and computer science courses.

These tools handle arbitrarily large integers exactly and explain every step, from the quotients of the Euclidean algorithm to the prime exponents behind Euler's totient function.

If you are new to the subject, start with the GCD and the Euclidean algorithm, move on to modular arithmetic and modular inverses, and then try the Chinese Remainder Theorem and primitive roots.

Number Theory tools

GCD & LCM Calculator

Greatest common divisor and least common multiple of up to eight integers, with Euclid's algorithm and prime factorization.

lcm(a, b) = |a·b| / gcd(a, b)
Open calculator

Prime Factorization Calculator

Factor any integer into primes, with the divisors, divisor count, divisor sum and Euler totient.

n = p₁^e₁ · p₂^e₂ · … · pₖ^eₖ
Open calculator

Euler Totient Calculator

Compute Euler's totient φ(n), the count of integers up to n that are coprime to n, with the product formula.

φ(n) = n · ∏ (1 − 1/p)
Open calculator

Chinese Remainder Theorem Solver

Solve a system of congruences x ≡ a (mod m), including moduli that are not coprime, with every merge step shown.

x ≡ aᵢ (mod mᵢ)
Open calculator

Primitive Root Calculator

Find the smallest primitive root modulo n, count them, list them and test whether a given g generates the group.

ord_n(g) = φ(n)
Open calculator

Modular Arithmetic Calculator

Add, subtract, multiply, divide and exponentiate modulo m, find modular inverses and solve ax ≡ b (mod m).

a ≡ b (mod m)
Open calculator

Extended Euclid & Modular Inverse

Find gcd(a, b), Bézout coefficients and modular inverses, with the full quotient / remainder table.

a·x + b·y = gcd(a, b)
Open calculator