A friend of mine posted the following on Facebook (with names redacted):

So [my daughter] comes home with this assignment:

*For each number from 10 – 99, carry out the following process.*

* If the number is a palindrome (e.g., 77), stop.*
* Else reverse the number and add that to the original. E.g.: 45+54 = 99.*
* If the result is not a palindrome, repeat step (2) with the result.*
* Record the final palindromic result and the number of steps taken.*

Most are simple.

- 56 + 65 = 110
- 110 + 011 = 121
- Stop. 2 steps taken.

The numbers 89 and 98 were given for extra credit, and they mysteriously explode, taking 24 steps. It made [my daughter] cry.

She wanted me to check her work, so I decided it was a good time to teach the wonders of Python, and we very quickly had a couple of simple functions to do the trick.

Well, you saw where this was going. How many steps does 887 take?

We’re up to 104000 steps so far, and Python is crying.

True or false: For a given n, the above algorithm completes in finite time?

I guess I’ve been living under a rock for the past 20 years, because I had never heard of this problem before. It turns out that numbers not known to lead to a palindrome are called Lychrel numbers. However, no number in base-10 has been proven to be a Lychrel number. The first few candidate Lychrel numbers (i.e., numbers that have not been proven to not be Lychrel numbers) are 196, 295, 394, 493, 592, 689, 691, 788, 790, 879, 887, 978, 986, 1495, 1497, 1585, 1587, 1675, 1677, 1765, 1767, 1855, 1857, 1945, 1947, 1997, 2494, 2496, 2584, 2586, 2674, 2676, 2764, 2766, 2854, 2856, 2944, 2946, 2996, 3493, 3495, 3583, 3585, 3673, 3675…

The above algorithm is called the 196-algorithm, after the smallest suspected Lychrel number.

For further reading, I suggest the following links and the references therein:

http://mathworld.wolfram.com/196-Algorithm.html

http://mathworld.wolfram.com/LychrelNumber.html

http://www.p196.org/

http://www.mathpages.com/home/kmath004/kmath004.htm (which contains a proof that 10110 is a Lychrel number in binary and that Lychrel numbers always exist in base )

http://en.wikipedia.org/wiki/Lychrel_number

### Like this:

Like Loading...

*Related*