# 90 arithmetic/tests.for.divisibility/nine.p

## Description

This article is from the Puzzles FAQ,
by Chris Cole chris@questrel.questrel.com and Matthew Daly
mwdaly@pobox.com with numerous contributions by others.

# 90 arithmetic/tests.for.divisibility/nine.p

What is the test to see if a number is divisible by nine?

arithmetic/tests.for.divisibility/nine.s

If the sum of the digits is divisible by nine, so is the number.

Proof:

Every integer n can be expressed as

n = a1*(10^k) + a2*(10^k-1)+ .....+ a_k+1

where a1, a2, a3, ...a_k+1 are integers between 0 and 9.

Note that 10 is congruent to 1 (mod 9). Thus 10^k is congruent to 1 (mod 9) for

every k >= 0.

Thus n is congruent to (a1+a2+a3+....+a_k+1) mod(9).

Hence (a1+a2+...+a_k+1) is divisible by 9 iff n is divisible by 9.

Continue to: