QiLing Tools

🔐Number Theory Calculator - Modular Power, Inverse, CRT and Euler’s Totient

Four everyday number theory calculations in one place: modular exponentiation (the core step in RSA and hashing), modular inverses with the Bézout identity, the Chinese remainder theorem for systems of congruences, and Euler’s totient with divisor statistics. Everything runs on big integers, so there is no rounding error.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use Number Theory

  1. 1Pick what to compute: modular power, modular inverse, Chinese remainder or Euler’s totient
  2. 2Enter the integers (for the Chinese remainder theorem, one “remainder modulus” pair per line)
  3. 3Read the result — inverses come with a check and congruences with the general solution

FAQ

Why is 7^222 mod 13 instant?
It uses fast exponentiation: the exponent is written in binary and the base is squared repeatedly from the top bit down, multiplying whenever the bit is 1. With 222 taking only 8 bits, a dozen or so multiplications finish the job instead of 222 of them.
What is a modular inverse and when does it not exist?
It is the x with a·x ≡ 1 (mod m). It exists only when gcd(a, m) = 1, that is when a and m are coprime; otherwise the tool says so plainly.
What kind of problem does the Chinese remainder theorem solve?
Classic remainder puzzles: “leaves 2 when divided by 3, 3 when divided by 5, 2 when divided by 7”. Enter one “remainder modulus” pair per line and you get the smallest non-negative solution plus the general form x = x₀ + Mk.
Can I use moduli that are not coprime?
Yes. A solution may then fail to exist, so each pair is checked: the difference of the remainders must be divisible by their gcd. If it is not, the system is reported as having no solution; if it is, the answer is given modulo the least common multiple.
What is Euler’s totient used for?
φ(n) counts the integers below n that are coprime to n. It underpins Euler’s theorem a^φ(n) ≡ 1 (mod n) and the choice of exponents in RSA. For a prime p, φ(p) = p − 1.