Lably
Skip to content

Casting out nines

Arithmetic procedure of verifying operations using modulo characteristics of digit 9

  • 7 min read
  • 9 chapters

Related on Lably

Through Integer, Digit sum and Addition

  • Adding the decimal digits of a positive whole number, while optionally ignoring any 9s or digits which sum to 9 or a multiple of 9. The result of this procedure is a number which is smaller than the original whenever the original has more than one digit, leaves the same remainder as the original after division by nine, and may be obtained from the original by subtracting a multiple of 9 from it. The name of the procedure derives from this latter property.
  • Repeated application of this procedure to the results obtained from previous applications until a single-digit number is obtained. This single-digit number is called the "digital root" of the original. If a number is divisible by 9, its digital root is 9. Otherwise, its digital root is the remainder it leaves after being divided by 9.
  • A sanity test in which the above-mentioned procedures are used to check for errors in arithmetical calculations. The test is carried out by applying the same sequence of arithmetical operations to the digital roots of the operands as are applied to the operands themselves. If no mistakes are made in the calculations, the digital roots of the two resultants will be the same. If they are different, therefore, one or more mistakes must have been made in the calculations.

Digit sums

To "cast out nines" from a single number, its decimal digits can be simply added together to obtain its so-called digit sum. The digit sum of 2946, for example is 2 + 9 + 4 + 6 = 21. Since 21 = 2946 − 325 × 9, the effect of taking the digit sum of 2946 is to "cast out" 325 lots of 9 from it. If the digit 9 is ignored when summing the digits, the effect is to "cast out" one more 9 to give the result 12.

More generally, when casting out nines by summing digits, any set of digits which add up to 9, or a multiple of 9, can be ignored. In the number 3264, for example, the digits 3 and 6 sum to 9. Ignoring these two digits, therefore, and summing the other two, we get 2 + 4 = 6. Since 6 = 3264 − 362 × 9, this computation has resulted in casting out 362 lots of 9 from 3264.

For an arbitrary number, 10ndn+10n−1dn−1+⋯+d0, normally represented by the sequence of decimal digits, dndn−1…d0, the digit sum is dn+dn−1+⋯+d0. The difference between the original number and its digit sum is

10ndn+10n−1dn−1+⋯+d0−(dn+dn−1+⋯+d0)=(10n−1)dn+(10n−1−1)dn−1+⋯+9d1.

Because numbers of the form 10i−1 are always divisible by 9 (since 10i−1=9×(10i−1+10i−2+⋯+1)), replacing the original number by its digit sum has the effect of casting out

10n−19dn+10n−1−19dn−1+⋯+d1

lots of 9.

Sign in to keep reading

8 more chapters are free with a Lably account.

More in From Lably lessons