The last expression above is exactly what it means to add the digits of a together in blocks of length n, starting from the right.

Running total: We now have divisibility tests for 2, 3, 4, 5, 8, 9, 10, 11, 16, 20, 27, 25, 32, 33, 37, 40, 50, 64, 80, 99, 100, 101.

3.3

# Take an Alternating Sum of Digits

To see if a is divisible by 11, alternately add and subtract the digits of a starting from the right; this alternating sum and a leave the same remainder when divided by 11. As in the previous section, we can extend this idea to blocks of digits. For instance, a is divisible by 91 if and only if the alternating sum of blocks of 3 digits is divisible by 91. To see if 23210481381 is divisible

by 91 we consider 381

481 + 210

# 23 = 87. Clearly 87 is not divisible by

91, so neither is 23210481381.

Alternating

Sum

of

Digits

# Trick:

# Let d be given, and suppose that

10^{n }

≡

1

(mod d) for some n.

Alternately add and subtract the digits of

a in blocks of n starting from the right, and call the result s. Now a and s leave the same remainder upon division by d; in particular, a is divisible by

d if and only if s is divisible by d.

Below are the values of d (2 ≤ d ≤ 102) for which the alternating sum blocks are at most 4.

d7

11

13

73

77

91

101

block size to add alternately

3

1

3

4

3

3

2

Why it works: Suppose that 10^{n }≡

1 (mod d), and we are given the

7