Modulo Calculator

Enter a number and a modulus to find the remainder, or add an exponent for a power mod n.

Any whole number, positive or negative.

A whole number other than 0.

Try

Result

You entered12345678901234567890 mod 9712345678901234567890 \bmod 97

12345678901234567890 mod 97=3\displaystyle 12345678901234567890 \bmod 97 = 3

Quotient

127275040218913071\displaystyle 127275040218913071

Truncated remainder

3\displaystyle 3

Congruence

12345678901234567890≡3(mod97)\displaystyle 12345678901234567890 \equiv 3 \pmod{97}
Show the work
  1. Division algorithm

    Dividing aa by nn and rounding the quotient down to a whole number qq leaves a remainder rr that is never negative. Here a=12345678901234567890a = 12345678901234567890 and n=97n = 97.

    Using a=n×q+r,0≤r<na = n \times q + r, \quad 0 \le r < n

    q=⌊1234567890123456789097⌋=127275040218913071\begin{aligned} q &= \left\lfloor \frac{12345678901234567890}{97} \right\rfloor \\ &= 127275040218913071 \end{aligned}
  2. Remainder from the quotient

    The remainder is what is left of aa after taking away qq whole copies of nn. Here q=127275040218913071q = 127275040218913071, so rr lands between 00 and 9696.

    r=a−n×q=12345678901234567890−97×127275040218913071=12345678901234567890−12345678901234567887=3\begin{aligned} r &= a - n \times q \\ &= 12345678901234567890 - 97 \times 127275040218913071 \\ &= 12345678901234567890 - 12345678901234567887 \\ &= 3 \end{aligned}
  3. Result

    So 12345678901234567890 mod 97=312345678901234567890 \bmod 97 = 3.

Worked examples