The first ever printed maths book, as far as we know, was the “Treviso Arithmetic”, printed in Treviso, near Venice, in Italy, in 1478. A printed edition of Euclid’s “Elements” came out soon after, in 1482. Unlike Euclid, where everything is proofs, the Treviso Arithmetic was a collection of practical ideas to do or check calculations.

One of its ideas about checking addition sums of whole numbers is “casting out nines”. Go through each number to be added, and add its digits, ignoring any nines. If your answer is more than nine, subtract nine, and keep on going until you have a number less than nine.

Add up all the less-than-nine numbers you get that way.

Calculate the similar less-than-nine number for your answer to the original addition sum. It should be the same.

The example it gives is 59+38=97. The less-than-nine numbers for the two numbers being added are 5 and 2. 5+2=7 = less-than-nine number for 97. It checks out.

Your challenge:

1. Explain why this works.

2. Would it work if we took, say, 7, instead of 9? If it would, why cast out nines rather than sevens?

The prize was won by Alex On.

**Solution**

When you “cast out nines” from a number, you get *the remainder when the number is divided by nine*.

For example, 5 is the remainder when 59 is divided by nine, 2 is the remainder when 38 is divided by 9, and 7 is the remainder when 97 is divided by nine.

Why? Because 9 divides exactly into 99, 999, etc., so the remainder when divided by 9 of 50, or 60, or 70, or whatever, is 5, 6, 7, etc., and the remainder when divided by 9 of 500, or 600, or 700, etc. is also 5, 6, 7, etc.

But when you do an addition sum, the sum of the remainders equals the remainder of the sum.

(9x_{1}+r_{1})+(9x_{2}+r_{2})=9(x_{1}+x_{2})+r_{1}+r_{2}

In fact, “casting out nines” also works to check multiplication sums.

(9x_{1}+r_{1})×(9x_{2}+r_{2})=9×[something]+r_{1}×r_{2}

Would “casting out sevens” also work? Yes and no.

If we work out remainders of numbers when divided by seven, then similar rules are true: the sum of the remainders equals the remainder of the sum, and also the product of the remainders equals the product of the sum.

But we can’t work out those remainders of numbers when divided by seven just by adding the digits of the numbers and throwing away sevens, because e.g. the remainder of 60 when divided by 7 is not 6.

“Casting out nines” would be better than “casting out sevens” even if we could work out remainders when divided by seven as easily as remainders when divided by nine. Why? Because to get a “false positive” from the casting-out test (a calculation shown as correct when in fact it’s wrong), the sum has to be out by a multiple of nine for the casting-out-nines test. It has to be out by a multiple of seven for casting-out-sevens. But multiples of seven happen more often than multiples of nine.