1012 and other such numbers

By 
Michael P. Greaney

Lychrel numbers

Numbers

"God made the integers, all else is the work of man," Leopold Kronecker.

Think of a number. Reverse its digits to form a second number. Now add the two together. Is the result a palindrome (reads the same forwards as backwards)? If not, reverse the digits of the new number and repeat the process. Continue with the reverse-add-repeat procedure until the result is a palindrome. Most numbers become palindromes very quickly, that is, in only a few iterations. Take 153 for example; it requires only two iterations.

IterationNumberReverseSum
1153+351=504
2504+405=909

Some numbers, however, do not appear to produce palindromes no matter how many times the reverse-add-repeat procedure is carried out. Numbers that don't produce palindromes are called Lychrel numbers. They were named so by Wade Van Landingham because "Lyrchel" was a rough anagram of his girlfriend Cheryl's name. We know that there are no single or double digit Lychrel numbers. The first number that may be a Lychrel number is 196. However, there is no proof that 196 and others like it, such as 879 and 1997, are actually Lychrel numbers. It is just that the reverse-add-repeat procedure has failed to produce any palindromes – and the procedure has been carried out to a billion iterations.

1012 and the like

What would happen if the difference between the two numbers were taken instead of their sum?

This might sound like Kaprekar's operation, which is responsible for one of the most popular Plus articles of all time. However, Kaprekar's operation requires the digits of the number to be reordered so the largest value digit is placed first and so on down to the smallest digit last. The question here is: What happens if the digits are not reordered?

Let's illustrate the procedure with 196.

IterationNumberReverseDifference
1196-691=-495
2-495--594=99
399-99=0

Any further iterations will only produce further zeroes.

Note that that leading zeros do not count, e.g. 594 – 495 = 99 not 099. The number of digits does not have to be preserved throughout the procedure as it does in the Kaprekar operation. It is the actual numerical value that matters, as it does with Lychrel numbers.

All one-, two- and three-digit numbers reduce to zero (you can see a proof here). The first number worth considering beyond those is 1012.

IterationNumberReverseDifference
11012-2101=-1089
2-1089--9801=8712
38712-2178=6534
46534-4356=2178
52178-8712=-6534
6-6534--4356=-2178
7-2178--8712=6534
1012

1012 is the first interesting number!

Notice the difference in the third iteration (emboldened). It turns up again four lines later as the difference in the seventh iteration. Any further reversal and subtractions will simply repeat the preceding four lines.

This appears to happen every time the reverse-subtract-repeat procedure is carried out: the numbers either converge to zero or end up going into a loop and repeat the same set of numbers over and over. I applied the reverse-subtract-repeat procedure to all numbers from one to 10 billion (1010) plus a sample of 10.1 billion 18-digit numbers. The results showed that none of the 20.1 billion numbers went on iterating for ever; the procedure always terminated with either zero or an end-loop. Whether this holds true for all numbers remains to be seen.

Following Wade Van Landingham's example I have named the numbers that terminate in an end-loop Eriam numbers, after my wife Máire.

The end-loop periods (after how many numbers the differences start repeating; four for 1012) were found to be of either 1 number (zero), 4, 12, 14, 17 or 44 numbers. The shorter periods occurred more frequently than the longer periods; nearly 94% of all numbers checked had end-loops with periods of one or four. Klaus Brockhaus checked a random selection of numbers up to 50 digits in length and found no period other than those given here. Perhaps other periods do exist, but have not been found yet.

Further details on end-loop periods can be found online. The periods are given there as 2 and 22, instead of 4 and 44. This is because the absolute value of the differences is taken instead of the actual values. The other periods remain unchanged.

The results further showed that exactly one-half of all numbers up to 1,516,730 have an end-loop consisting of just zero. Beyond 1,516,730 more than half of the numbers had end-loops with four or more numbers.

The distribution of Eriam numbers

The table below shows how many Eriam numbers there are for different numbers of digits. Among the four-digit numbers there are 637 Eriam numbers, which is just over 7% of all four-digit numbers. The table shows that as the number of digits in a number increases so does both the number and percentage of Eriam numbers. The table was generated by a computer program written to find and count the numbers.

Number of digitsTotal number of Eriam numbersPercentage of Eriam numbers
46377.078
544,40049.333
6439,54248.838
74,752,42052.805
848,948,98954.388
9548,853,24060.984
105,482,449,62760.916

There are normally gaps in the number line between Eriam numbers, particularly among lower numbers, but occasionally there is a run of consecutive numbers, all of which are Eriam numbers. The first occurrence is the two-number sequence 10,012 and 10,013. There is a 17-number run between 200,004,984 and 200,005,000, but the longest run I found is the 25-number sequence, 3x1017 + 4979 to 3x1017 + 5003, i.e. 300,000,000,000,004,979 to 300,000,000,000,005,003. Longer runs might be expected among the higher numbers as the corresponding higher percentage means that the Eriam numbers occur more frequently, i.e. there is a greater density of them.

Greatest and least delays

The number of iterations taken to reach the start of the end-loop varies: 3201 begins its end-loop on the first iteration, while 1,000,509,057 requires 84 iterations. A palindrome reaches zero on its first iteration, of course, but a number such as 1,000,122,729 can take 107 iterations to reach zero.

Stop sign

The numbers checked all terminated with an end-loop. Could this be true for all numbers?

End-loop characteristics

Most of the 20.1 billion numbers surveyed had end-loops consisting of four numbers and always of the form ±21…78 and ± 65…34, where the ellipses represent intervening digits. These intervening digits are usually nines, as in the end-loop of 87,968,465, but not always, as in the end-loop of 10,002,729. They end in concatenation of these numbers, i.e. 21,782,178 and 65,346,534. Some, like 1012 of course, have no intervening digits.

Terminating palindromes

The numbers that reduce to zero, likewise, ended in a limited set of numbers. The terminating palindrome (the last number before the zero) for most of them was 9…9 (although for small numbers it was a single nine). The digits between the two end nines, when there were any, were either zeros, nines or both. The terminating palindrome for 82,427 is 9999, while for 82,432 it is 9009.

The exception is 54…45. The terminating palindrome of 1166, for example, is 5445 and that of 180,004 is 549,945.

Conclusion

It would seem that adding a number to its reverse repeatedly is like sending a ball skywards; there's no limit to how far it can go. Subtracting the numbers is like dropping the ball: it goes only so far until it hits the ground and either stops or starts bouncing up and down.


About the author

Michael P. Greaney

Michael P. Greaney is a writer with particular interests in astronomy and mathematics. He has written articles for a number of astronomical magazines and was a contributing author to the book Observing and Measuring Visual Double Stars (Springer, 2012).