[27 December 2007; crucial typo corrected, graphics added 29 December]

Over Christmas I got a copy of Oystein Ore’s book *Number theory and its history* (New York: McGraw-Hill, 1948; reprint New York: Dover, 1988).

In section 2-3, exercise 5 reads

5. Prove that in the decadic number system [i.e. using decimal numerals] the fifth power of any number has the same last digit as the number itself.

This is straightforward enough, if you’ve just read the preceding section. (My exposition isn’t as good as Ore’s, so I won’t try to explain it.)

But now consider a related problem.

For numbers *n* whose decimal representation ends in a particular digit *d*, we can make a little directed graph that makes it easy to calculate the final digit of any number multiplied by *n*. Each graph will have ten nodes, labeled 0 through 9, and there will be an arc from node *i* to node *j* if and only if multiplying *n* by a number ending in *i* produces a number ending in *j*.

For the digit 3, for example, we’ll have the arcs 0 → 0, 1 → 3, 2 → 6, 3 → 9, 4 → 2, 5 → 5, 6 → 8, 7 → 1, 8 → 4, and 9 → 7. Like this:

And for the digit 5, there will be arcs from each odd-numbered state to state 5, and from each even-numbered state to state 0. And so on.

Like this:

There ought to be a name for these graphs, but I don’t know of one. I’ll call them *multiplication graphs*.

Now, consider what problem 5 means in terms of these multiplication graphs. For the given number, we pick the appropriate graph. If we raise the number to the power 0, the result is a number whose decimal representation ends in ‘1’. (Because it’s always the number 1.) Call the state labeled ‘1’ the start state. A path of length 1 will always take us to the state named for the digit whose multiplication properties the graph represents: in graph 3, a path of length 1 takes us to state 3, in graph 7, a path of length 1 takes us to state 7. Call this state the ‘characteristic state’.

If we raise the number to the power *n*, the result will have a decimal representation ending in the digit we reach by following a path through the graph, beginning at the start state and having exactly *n* steps. Final digit of the square? Follow a path two steps long. Final digit of the fifth power? Follow a path five steps long.

So: in terms of multiplication graphs, exercise 5 amounts to proving that in each graph, a path of length 5 takes you to the same state as a graph of length 1. Or, equivalently, that there is a cycle of length 4, or 2, or 1, beginning at the characteristic state of the graph.

It’s clear that there must be cycles in the graphs, and that the cycles can’t have length greater than 10, since there are only ten states. It’s clear, after a moment’s thought, that any cycle must either hit only even numbers or only odd numbers, and so any cycle must have length less than or equal to 5.

In fact, however, the cycles are all for length 1 (in graphs 0, 1, 5, and 6), 2 (graphs 4 and 9) or 4 (graphs 2, 3, 7, 8).

Why are there no cycles of length 5?

I think that’s because 5 is not the target but 5-1 (5 minus 1)

And you can see that all the length of the cycles divides 5-1 (4 | 4, 2 | 4 and 1 | 4)

Innovimax

The only graph that can include 0 is 0, the only graph that can include 5 is 5 – they both have length 1, the others have one less available node.

Daniel, yes, I think you are right. At least, that is the conclusion I came to, thinking about this further in the last few days.

Readers who would like a less dense explication of this reasoning may want to consult the posts on multiplication graphs and cycles in them which I drafted over the weekend but did not post until today. (Also, they have pretty pictures made with graphviz and OmniGraffle).

I have a question. For example, does the 3 to the zero power equal to one? Or is it zero? I can’t seem to figure this out. Thanks.

Heya – yes, 3 or any number to the power 0 is equal to one.

One way I find to think about this is to remember that for any number n and any power p, increasing p by one produces a result n times as large as the previous result; decreasing p by one produces a result equivalent to mutiplying the previous result by 1/n.

For example 3 ** 2 = 9.

So 3 **3 should be three times that. And it is. 3 ** 3= 3 * 3 * 3 = 27.

Going the other way, 3 ** 1 = 3 ** 2 / 3 = 9 / 3 = 3.

And 3 ** 0 = 3 ** 1 / 3 = 3 / 3 = 1. And 3 ** -1 = 1/3.

And so on.