MathorynMathematical Formula Database

Number Theory

Digit Sum Rule (mod 9)

Every integer is congruent modulo 99 to the sum of its decimal digits, because 10≡1(mod9)10\equiv1\pmod9. It is used for the divisibility tests by 33 and 99 and for the old check of arithmetic known as casting out nines.

n≡S(n)(mod9)n\equiv S(n)\pmod 9
LaTeXn\equiv S(n)\pmod 9

Variables

nn
integer
S(n)S(n)
sum of the decimal digits of n

Example

Find 123456 mod 9123456\bmod9.

  1. S=1+2+3+4+5+6=21S=1+2+3+4+5+6=21, and 21≡321\equiv3.
  2. Check: 123456=9⋅13717+3123456=9\cdot13717+3.

Answer: 123456≡3(mod9)123456\equiv3\pmod9.

Related formulas