The reverse and add process, if repeated will often reach a palindrome. In base 10 it is unknown whether numbers exist that do not eventually reach a palindrome (196 is the smallest current candidate in base ten.)
In binary, however, there are numbers that never reach a palindrome. Find the smallest such number and prove it never reaches a palindrome.
(In reply to
there seems to be a pattern here by Charlie)
Poring over Charlie's output, the simplest pattern that seems to emerge, starting from the fifth line (decimal representation 180) is like this:
10 A 01 B
where A is some number of consecutive 1s and B is the same number of consecutive 0s.
Let n be the number of 1s in A and 0s in B. When we perform the reverse-and-add process to a number of this form, we end up with:
11 (n-2 0s) 1000 (n-2 1s) 01
Performing it a second time gets us to:
10 (n 1s) 01 (n+1 0s)
A third time:
11 (n 0s) 10 (n-1 1s) 01
And finally a fourth time:
10 (n+1 1s) 01 (n+1 0s).
So we end up back where we started, just with one additional 1 and 0 in A and B, respectively. Therefore this pattern repeats forever and the number never becomes a palindrome.
|
Posted by tomarken
on 2021-04-29 10:47:00 |