November 2, 2020

Digits, Squares, and Cycles

Fascinating patterns lurk among the digits of whole numbers.

Pick a positive integer, say 57. Square each of the digits, then add the squares together: 52 + 72 = 25 + 49 = 74. Do the same thing with the digits of 74: 72 + 42 = 49 + 16 = 65. Keep repeating the procedure, using successive sums of squares.


You end up with the following sequence of numbers: 57, 74, 65, 61, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, and so on. Notice that after a few steps, the numbers begin repeating themselves in a definite cycle (or loop): 37, 58, 89, 145, 42, 20, 4, and 16.

Try another number, say 88. The following sequence arises: 88, 128, 69, 117, 51, 26, 40, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, and so on. It takes a little longer to get there and the cycle's entry point (16) is different, but the same repeating set of numbers comes up.

Amazingly, it turns out that for a given positive integer, this procedure always leads to one of just two cycles: either the cycle of numbers noted above or a string of 1s. For instance, starting with 19 produces the sequence 82, 68, 100, 1, 1, 1, and so on. Beginning with 123,457 leads to the repeating set of numbers 4, 16, 37, 58, 89, 145, 42, and 20.

Mathematician Eugene D. Nichols first encountered a mathematical proof establishing this cyclic digital behavior in a Polish book of problems by Hugo Steinhaus, published in 1958. However, Steinhaus proved the theorem only for squaring the digits. "I got curious about what would happen when you did it to the third power, fourth power, and so on," Nichols said.

For example, suppose you use 3 as the exponent and start with the positive integer 57. You get 53 + 73 = 125 + 343 = 468. Continuing the procedure generates the following numbers: 792 (43 + 63 + 83), 1080, 513, 153, 153, 153, 153, and so on. In general, this procedure always leads to some sort of cycle, and there are nine possible cycles. The longest cycles contain only three numbers: 55, 250, and 133; 160, 217, and 352; and 160, 217, and 352.

"We wanted to find out whether there is any relationship between the number of loops we get and the power to which the digits are raised," Nichols said. Collecting data up to the fifteenth power, "we couldn't discern any kind of relationship, except one. For the odd powers, there are more loops than for the even powers."

Jerry Glynn and Theodore W. Gray devoted a section of their book The Beginner's Guide to Mathematica Version 3 to the problem and suggested ways of calculating the necessary sequences and searching for patterns.

Glynn had learned about the problem from Nichols during a lull at a mathematics meeting. "He started me off on the problem with a conspiratorial tone and a gleam in his eye," Glynn recalled. "He also started very, very slowly so I followed the steps easily until I could move ahead on my own. I was trapped and no longer bored."

In the Beginner's Guide, Gray noted, "Readers should be made aware that Jerry is having some sort of religious experience. He seems awed by these numbers. It is quite remarkable that the cycle lengths are so short, given how large the numbers are."

There's still lots to explore in this niche of number theory, and there's no proper proof yet that all numbers and all exponents always cycle.

Originally posted February 2, 1998

No comments: