## Thursday 14 July 2022

### Some History Notes on Casting Out Nines, and request for information

I'm Re-posting some old blogs to try and preserve some notes,  and do some editing

In my youth, back in the dark ages before calculators, one of the common mathematical tools we were taught was called casting out nines. It seems it is not common anymore, perhaps the errors students make with calculators no longer submit to the simple check of this ancient method. If you happen to be of the generation who have been kissed on the forehead by the Gods of Electronics and actually don't know the method, you can find some notes on my page, and also here is a brief video from YouTube.

I have a note on my MathWords page on the subject from a respected math historian (Albrecht Heefer) that tells me, "Casting out nines is believed to be of Indian origin, but it does not occur before 950. Maximus Planudes called it 'Arithmetic after the Indian method". Along the way I seem to have a note from him telling me that I can find more confirmation on the web site of David Singmaster, the famous historian of mathematical recreation; but while searching there, I seem to have a note that claims the first mention of casting out nines was by the Latin writer Iamblichus in 325 AD... But he was talking about Nichomachus, a Pythagorean who lived around 100 AD.

"325 Iamblichus: On Nicomachus's Introduction to Arithmetic - first mention of Casting Out Nines; first description of the Bloom of Thymarides; first Amicable Numbers."

Now the common thought, or at least as I thought I understood it, was that the inventors of the hindu-arabic numerals had developed casting out nines and it sort of made its way into the west with the introduction of the Arabic numbers. Leonardo of Pisa, the famous Fibonacci whose bunny sequence you remember from school (of course you do, 1, 1, 2, 3, 5, 8, 13, 21...... That sequence) was a major influence in bringing both to the west with his famous book, the Liber Abaci, (the book of calculating) around 1202.

But the fact is that the general public held on to their Roman numerals for several centuries, and legal documents had to have them in some areas up into the 15th century.. Now the problem, at least for me, is that it seemed much less likely that someone would develop casting out nines using Roman numerals.. see if you are using Arabic numerals, you take a number and add up the digits... 2534 would give 2+5+3+4 = 14 and then adding 1+4 = 5 so we know that if you divide 2534 by nine, you get a remainder of 5. Now in Roman numerals we write 2534 as MMDXXXIIII ... So I set about trying gto figure out casting out nines with Roman numerals, and it hit me.
numbers that are powers of ten always have a remainder of one when divided by nine, so any X, C, or M is crossed out and an I is added at the end for it.  So MMDXXXIIII is replaced with DXXXIIII+II.  Maybe they would shorten that to DXXXVI.  Now replace the three tens with Is also to get DVI+III.  Now five, fifty, or five hundred would have a remainder of five when divided by 9, so D becomes a second V, and the two Vs become an X which becomes an I  (I can visually all this as a mental operation to experienced "casters") leaving him with five I's, or just a V = 5  for the remainder. In fact without writing anything down you can just read across MMDXXXIIII, counting 1,2,7,8,9,10,11,12,13,14...and any time with a sand tray they would know that subtracting is taking one from the X column and put it in the I column.

If they converted all the Ds and Ls and V's to five of the powers of ten, and avoided any IV orXC type subtractors,  I can see it becoming obvious, so maybe that is how it came about. If you write the Roman numbers with only unit (that's how math types say ONE) multipliers, like M for 1000 or X for 10 or C for 100, then all you would have to do is count the number of digits (not add them up). For example MMCCXII has seven digits, so the number 2212 should have a digit root of 7, which it does. And for really long numbers, you could throw away groups of nine in the same way we do with casting out nines..... MAYBE... but I wonder..  So do any of you scholars out there know of an example of casting out nines from something using other than Arabic numerals?  Please share if you do.

Anyway, I'm still looking for that Rogue Scholar out there who happens to have the original of Nicomachus' "Introduction to Arithmetic" laying around on his bookshelf and would like to translate for me to explain where he says it came from (if indeed he did).

I have played around with other divisibility rules, and even made up some of my own. If you want to read these early blogs first, you might try this one, or another here.

The reason I am reminded of all this is that I just read an interesting article by the almost unknown English mathematician, Henry Wilbraham (July 25, 1825 – February 13, 1883), in an old Cambridge and Dublin Mathematical Journal. He points out that you can construct a similar division technique for any number. The idea is to use the period of the smaller numbers repeating fraction to break apart the second number. As an example, if you wanted to test to see if some large number was divisible by 37, you would first find the digital period length of the decimal 1/37. It turns out that 1/37 = 0.02702702702702703 so its period is three.
Now we take the really big number we want to test, say 7,424,883,933,621. We want to know if that number is evenly divisible by 37, and if it isn't, what the remainder will be.
The variation in Wilbraham's approach, and as I point out later it's not really an a variation at all, is to break the larger number up into sections of three digits (the period of our divisor's reciprocal), so we would add the 621+933+883+424+7= 2868. Now just as we can continue to compute digital roots when casting out nines, because there are more than three digits here, we can recombine those to get 2+868 = 870. Now all we have to do is divide 37 into 870 and if it goes evenly, it's a factor of the larger 13 digit number. If not, the remainder we get will be the same as the remainder when dividing the original number.
Turns out 37 is not a factor of 870 but leaves a remainder of 19. The good news is that we know that when we divide 7,424,883,933,621 by 37, we will get the same remainder.

It turns out that the reason this works is the same as the reason that casting out nines works. The period of 1/9 is one,.11111....., so we add every digit.

The math behind this is simple enough that I think any bright high school kid could understand it. If the period of a numbers reciprocal 1/n is some number p, then it must be true that 10p-1 is divisible by n. In my example, 103-1 must be divisible by 37, and is.
So if we break our larger number, N, up into periods of p, and express the sets of digits as individual numbers, A,B,C,D... so that N= A+10pB + 102p...etc.
So we know that N= A+ (kn+1)B+ (kn+1)2 C.... and if we distribute all these kn+1 terms all the kn powers can be collected (and are thus a multiple of our smaller divisor, n) and the rest will be A+B+C... which is the sum of the periods, and thus the remainder. If this number is longer than the period of 1/n, we can apply it again by using the same reasoning.

I should point out, because Wilbraham is so unknown, he did not spend his entire mathematical life doing arithmetic novelties. He is known for discovering and explaining the Gibbs phenomenon, the peculiar manner in which the Fourier series of a piecewise continuously differentiable periodic function behaves at a jump discontinuity, nearly fifty years before J. Willard Gibbs did. Gibbs and Maxime Bôcher, as well as nearly everyone else, were unaware of Wilbraham's work on the Gibbs phenomenon.

Most students know a rule for testing divisibility by 11 that goes sort of like this usually:  add up every other digit, then add up the remaining digits, if their difference is o or a multiple of 11, then it's divisible by 11. For  42351 we add 4, 3, and 1 to get eight, and 2  + 5 =7 , so 42351 is not divisible by 11.  But let's explore Wilbraham's  method,  The period of 1/11 is two digits, .0909....  Breaking the trial number into 4 + 23 + 51 we get 78, which we can see immediately is one more than a multiple of eleven.

There are many divisibility shortcuts that are quicker for some numbers.  Thirteen has a period of six digits, and seventeen hasw a period of 16 digits, so unless you are working with very large numbers, the reduction of labor may not be great.  Stll for numbers with shorter periods it's just "casting out."