The Number 9, Not So Magic After All

Rick LyonsOctober 1, 20146 comments

This blog is not about signal processing. Rather, it discusses an interesting topic in number theory, the magic of the number 9. As such, this blog is for people who are charmed by the behavior and properties of numbers.

For decades I've thought the number 9 had tricky, almost magical, qualities. Many people feel the same way. I have a book on number theory, whose chapter 8 is titled "Digits — and the Magic of 9", that discusses all sorts of interesting mathematical characteristics of the number 9 [1]. That book is not alone in its fascination with the number 9. If you search the Internet for the phrase "magic number 9" you'll receive dozens of relevant "hits."


This article is available in PDF format for easy printing

I first began thinking the number 9 was special years ago when I encountered a straightforward math problem alleged to test a person's intelligence. The problem is; given

you are required, using pencil and paper, to find the digit A within 60 seconds.

Back then, of course, I couldn't solve that problem in 60 seconds. Later I learned the solution requires us to know the curious property that when you multiply a natural number by 9, the sum of the product's digits are a whole multiple of 9. (By "natural number" I mean a positive whole number, what mathematicians call "positive integers.")

For example, 762 x 9 = 6858, and the sum of 6+8+5+8 is 27 which is a whole multiple of 9. That is, the whole number 3 times 9 equals 27. Try this yourself: multiply a natural number by 9 and add the product's digits to see that their sum is always a whole multiple of 9.

So to quickly solve Eq. (1) for A, we view that equation as:

Because (523 + A)2 is a natural number, after multiplying it by 9, the sum of the digits on the left side of Eq. (2) must be a whole multiple of 9. That is:

where 36 is a whole multiple of 9. Because 36 – 32 = 4, A = 4 is the problem's solution. (For Matlab aficionados, Appendix A gives a Matlab software method of finding A in Eq. (1)).


If we sum the digits of any natural number and subtract that sum from the original number, the result is a whole multiple of nine. As an example, for any devil worshippers among us, the sum of the digits in 666 is 18. And 666-18 = 648, which is a whole multiple of 9 (9 x 72 = 648). How remarkable!


Multiplying natural numbers by 9 leads to some interesting results. While once playing around with my hand calculator I discovered the products shown in Table 1 of Figure 1.

Multiplying particular sequential natural numbers by 9 produce interesting numerical patterns. For example, the noteworthy Tables 2 through 5 can be found in Reference [1].

Reinforcing my notion of the special nature of the number 9, a neat parlor trick employing the magic of 9 that you can use to amaze your friends can be found at: http://www.youtube.com/watch?v=nd_Z_jZdzP4


Dividing a natural number by 9 also produces some peculiar results. Appendix B presents a few examples of those results.


Thinking about the apparent magical properties of the number 9, I recalled a quote from a dead mathematician. The 19th century German mathematician Leopold Kronecker, a pioneer in the field of number theory, believed "Die ganzen Zahlen hat der liebe Gott gemacht, alles andere ist Menschenwerk." ("Natural numbers were made by our dear God, all else is the work of men.")

Now if God (or Mother Nature, if you prefer) created the natural numbers I wondered, "Why would God give the number 9 magical properties? Doing so seems prejudicial, downright unreasonable." Then it hit me, 9 is one less than the 10 in our base-10 (decimal) number system. Next I wondered, "Does the digit 9 also have special properties in number systems having a base other than 10? Or could there be other digits that are magical in other number systems?"

Exploring the natural numbers in a base-7 number system (whose digits are 0,1,2,3,4,5, and 6) I created the tables in Figure 2.

So there you have it. In the base-7 number system, the number 6 is magical!

For those familiar with computer programming's hexadecimal (base-16) number system multiplying a natural number by the digit F, a decimal 15, the sum of the product's digits will be a whole multiple of decimal 15. Thus, in the hexadecimal number system the hexadecimal digit F (decimal 15) is magical.

Being in the DSP field I, of course, wondered if there was any special behavior when we multiply numbers in our familiar binary number system. The only mildly interesting multiplication pattern I found in our base-2 binary number system is shown in Figure 3.


So after all these years, I now realize the number 9 is not a magic number. In a base-B number system, the number B-1 is the digit with magical properties.

If we want to call anything "magic", we might generally agree with Herr Kronecker and merely say, "All natural numbers can be magical."


Thinking about numbers, something has just occurred to me. Millions of technically astute people consider the decimal number 42 to be a truly extraordinary number. They believe 42 is, literally, the Answer to the Ultimate Question of Life, the Universe, and Everything. To understand this belief, search the Internet for the phrase "the answer to life the universe and everything".


Here's one way to solve Eq. (1) for A. Given:

we can write:

Squaring (523 + A) and collecting non-zero terms on one side of the equation we can write:

Using Matlab's symbolic math to solve the 2nd-order quadratic Eq. (A-2), we enter:

Giving us two possibilities for the value of A:


Dividing a natural number by 9 also yields what I think is an interesting property. That is, dividing a natural number by 9 produces a decimal quotient having a positive integer I, to the left of the decimal point, and an endlessly repeating single decimal fractional digit F, to the right of the decimal point, as

Examples of this behavior are:

OK, these division-by-9 examples may not seem too exciting, but I noticed something about division by 9 that seems almost magic. There's a way to determine the fraction digit F without performing any division.

If you add the digits of an integer dividend N you'll obtain a natural number P.   

  • If P is a single digit less than 9, then the fraction digit F = P.

Looking at the above Eq. (B-3), the sum of the dividend N = 134 digits is P = 1+3+4 = 8, so F = P = 8.     

  • If P is more than one digit, we merely add P's digits to obtain the single digit Q, in which case, the fraction digit F = Q.

Looking at the above Eq. (B-4), the sum of the dividend N = 76241 digits is P = 20. Because 20 has two digits, we add them to yield Q = 2+0 = 2, and our fraction digit F = Q = 2.

So the point of this N/9 = I.FFFFF... discussion is that you can determine the fraction digit F by inspecting N, no actual division is necessary. (A week or so after I wrote this blog, I learned that the above iterative adding-of-digits operation is referred to as "finding the digital root" of a natural number. See references [2] and [3].)

Other interesting 'divide by 9' results can be seen. Grab your hand calculator and divide a small natural number N by 99, then divide N by 999, and finally divide N by 9999 and see the peculiar results.

[1] Albert H. Beiler, "Recreations in the Theory of Numbers", Dover Publications, 1966, p. 54.
[2] http://en.wikipedia.org/wiki/Digital_root
[3] http://oeis.org/A010888

[ - ]
Comment by Rick LyonsOctober 3, 2014
Hi Dave,
Another Beatles fan huh? Ha ha. I think John Lennon created that "Revolution 9" because he was becoming Yoko Ono-fied.

[ - ]
Comment by dcomer_backupOctober 3, 2014
Au contraire Rick: consider the Beatles White album where "number 9" is constantly repeated on the track titled "Revolution 9". Not so magical....

Sorry, I couldn't resist. Excellent blog entry as usual.

[ - ]
Comment by JérômeFebruary 11, 2015
Hi Rick,

Very interesting post. Just a comment, did you remark that the Appendix B: FUN WITH DIVISION BY 9 was directly related to the section ANOTHER CURIOUS PROPERTY OF 9 ?

Indeed in Appendix B, you write :
N/9 = I.FFFFFFFFFFFFFF..., where 0<=F<=8 (the limitation of F to 8 is to obtain a unique description)
This can be rewritten as :

From the section ANOTHER CURIOUS PROPERTY OF 9 ?, we can write :
N - f(N) = 9 k,
where f(N) is the function that sums the digits of N. This can be rewritten as :
N = 9 k + f(N)

The value of f(N) can be written as :
f(N) = 9 m + n (where m and n depend on N, but it's not shown here for simplicity),
where n is the sum of the digits of N modulo 9.

So, using this last formula, N can be written as :
N = 9 k + 9 m + n = 9 (k+m) + n

Making a relation between this last equation and the second, we have F = n, i.e. F is the sum of digits of N modulo 9.

But I think there are plenty of ways to demonstrate each property, and there are propably a lot of relation between all the properties.


PS : After having read your post, I bought the Beiler's book ;)"
[ - ]
Comment by Alex4August 3, 2015
Great post from a non-mathematician!

I am more of a mathematician, and I remember when I first discovered the mathematical proof fro "Why" it is that the sum of digits of a number is divisible by 9 implies that the number is divisible by 9. When I discovered this (the rough version of the proof is given in the other comment by Jerome!), I realized that this property of 9 is not magical.

And in fact, the proof of it relies taking the digits of our number and deconstructing them as a sum of the multiples of 10 (the base B, in your article). So yes, it is simply the magic of B-1. But not really magic, once you see the proof and understand it!
[ - ]
Comment by PhulusoFebruary 25, 2020
9 x 9 + 7 = 88
98 x 9 + 6 = 888
987 x 9 + 5 = 8888
9876 x 9 + 4 = 88888
98765 x 9 + 3 = 888888
987654 x 9 + 2 = 8888888
9876543 x 9 + 1 = 88888888
98765432 x 9 + 0 = 888888888
[ - ]
Comment by Rick LyonsFebruary 25, 2020

Hello Phuluso. Ah ha. Neat! Thanks for your additional table of number 9 magic.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Please login (on the right) if you already have an account on this platform.

Otherwise, please use this form to register (free) an join one of the largest online community for Electrical/Embedded/DSP/FPGA/ML engineers: