Blog #25Robert J. LopezCar Talk Puzzler - May 21, 2011JSFHNational Public Radio in the USA carries Car Talk, a humorous phone-in program in which Tom and Ray Magliozzi (Click and Clack, the Tappet Brothers) diagnose and offer solutions for mysterious auto-related maladies. It's an amusing hour on Saturday mornings.One of the program's segments is a weekly Puzzler, a logic (or other) mental puzzle begging for a solution. On May 21, 2011, my wife and I were driving westward across Michigan, headed for a family visit with our son in Iowa. Our radio picked up the morning's broadcast of Car Talk, during which the following Puzzler caught our attention. The link will take you to the exact wording. Here's a synopsis.A six-digit odometer shows a palindromic number. The car it's in is driven no more than an hour, and again the odometer shows a palindromic number. How far was the car driven?When I described this puzzle to a colleague, he immediately suggested the successive palindromes 11 and 22, etc. However, a six-digit odometer would display 000011, and that probably shouldn't be considered a palindrome. So, to a mathematician the problem is "What are all the six-digit palindromes (no leading zeros), and what are the successive differences?As my wife was driving, I was free to think how I might use Maple to get a list of all such palindromes, wondering if, perhaps, the numtheory package had a "palindrome" command. My wife, a psychiatric nurse, who clearly did not deal with logical intellects in her professional career, shortly announced "It has to be 11. If the odometer started at 199991, eleven additional miles would bring it to 200002." Believe me, I didn't even want to know how she did this. I just sat back and marveled at the mate I had picked more than 40 years ago.But as soon as I could get to a Maple session, I did, indeed, list all the six-digit palindromes, and discovered that adjacent palindromes differed by 11, 110, or 1100. Since it is unlikely that the car in question traveled 110 miles in an hour, the answer to the Puzzler had to be 11. And it was. (Click the link for the solution as presented by Tom and Ray.)JSFHHere's how I did the calculations. The first thing I did was to satisfy myself that Maple had no built-in facility for generating palindromes, so I needed a representation of a six-digit palindrome. This I took as LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUkjbWlHRiQ2JVEnYWJjY2JhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnL0YzUSdub3JtYWxGJw== or LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJL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jVGNUY1RjVGNSomSSJqR0YlRjUsJi1GODYkRjoiIiVGNUY6RjVGNUY1KiZJImtHRiVGNSwmLUY4NiRGOiIiJEY1LUY4NiRGOiIiI0Y1RjVGNS9GQzsiIiEiIiovRj1GTC9GNDtGNUZOISIiThe first few members are LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYtLUkjbW5HRiQ2JFEnMTAwMDAxRicvJSxtYXRodmFyaWFudEdRJ25vcm1hbEYnLUkjbW9HRiQ2LVEiLEYnRi8vJSZmZW5jZUdRJmZhbHNlRicvJSpzZXBhcmF0b3JHUSV0cnVlRicvJSlzdHJldGNoeUdGOC8lKnN5bW1ldHJpY0dGOC8lKGxhcmdlb3BHRjgvJS5tb3ZhYmxlbGltaXRzR0Y4LyUnYWNjZW50R0Y4LyUnbHNwYWNlR1EmMC4wZW1GJy8lJ3JzcGFjZUdRLDAuMzMzMzMzM2VtRictRiw2JFEnMTAxMTAxRidGL0YyLUYsNiRRJzEwMjIwMUYnRi9GMi1GLDYkUScxMDMzMDFGJ0YvLyUrZm9yZWdyb3VuZEdRKlswLDAsMjU1XUYnLyUpcmVhZG9ubHlHRjsvJTBmb250X3N0eWxlX25hbWVHUSoyRH5PdXRwdXRGJ0Yv, but the whole list contains 900 members, as LUklbm9wc0clKnByb3RlY3RlZEc2I0kiUEc2Ig== = print(); # input placeholderJSFHshows. Now the differences between successive palindromes is found withQyQ+SSJRRzYiNyMtSSRzZXFHJSpwcm90ZWN0ZWRHNiQsJiZJIlBHRiU2IywmSSJrR0YlIiIiRjFGMUYxJkYtNiNGMCEiIi9GMDtGMSwmLUklbm9wc0dGKTYjRi1GMUY0RjFGNA==a list of length LUklbm9wc0clKnByb3RlY3RlZEc2I0kiUUc2Ig== = print(); # input placeholder, as expected. However, the distinct members of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUkjbWlHRiQ2JVEiUUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy9GM1Enbm9ybWFsRic= areLUkoY29udmVydEclKnByb3RlY3RlZEc2JEkiUUc2Ikkkc2V0R0Yk = print(); # input placeholderand in fact, the first time the difference between successive palindromes is 11 isQyUtSSdtZW1iZXJHJSpwcm90ZWN0ZWRHNiUiIzZJIlFHNiIuSSJyR0YpISIiJkkiUEdGKTYjRis= = print(); # input placeholderJSFHIs a gap of 11 unique? Just how prevalent is such a difference between two six-digit palindromes? In Table 1, the first column lists the index LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUkjbWlHRiQ2JVEia0YnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy9GM1Enbm9ybWFsRic= telling where in the sorted list LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYkLUkjbWlHRiQ2JVEiUEYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy9GM1Enbm9ybWFsRic= two adjacent palindromes differ by 11, and the second and third columns give the adjacent palindromes.I can't help but note the first pair in the list! (I have no idea how she did it. She doesn't knit, but avidly solves Sudoku puzzles of all types, and is better at it than I am.)QyQ/KEkia0c2IiIiIkYmLUklbm9wc0clKnByb3RlY3RlZEc2I0kiUUdGJUkldHJ1ZUdGKUAkLyZGKzYjRiQiIzYtSSZwcmludEdGKTYjNyVGJCZJIlBHRiVGMCZGNzYjLCZGJEYmRiZGJiEiIg==print(); # input placeholderTable 1 Successive palindromes that differ by 11

From Table 1 is should also be clear that because of the gap between the pairs, there aren't three successive palindromes each pair of which differ by 11. The Puzzler can be solved by searching just adjacent palindromes.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2I1EhRic=