When is the next palindrome?

955 Views Asked by At

Okay, this is more just for fun than anything else.

I'm driving in my car today, (true story) and my odometer is about to hit $81,818$. So, being a math nerd and all, I immediately see the pattern and think palindrome... Then my eye hits the trip meter (the one that has the tenths of miles) and it is hovering at $3,241.1$ and I realize that I am going to have both number become palindromes together! And so a few minutes goes by and sure enough, I have two palindromes on my odometer $$81,818 \text{ and } 3,242.3$$ Being a math student, my mind immediately thinks "I wonder when this will happen again?" So, when is the next time this is going to happen again?

So because the rate of change is slower for the odometer number, it really depends on that. I also figure each unit of increase in the odometer number corresponds to 10 different consecutive tenths in the trip meter (for example if my odometer reading changes to 81,818 when the trip meter reads 3,241.6, the odometer will change to 81,819 when the trip meter reads 3,242.6).

So, the next palindrome for the larger odometer is $81,918$ which means 100 miles has passed. Therefore the trip reading is $3,341.6$ and it is easy to see that the trip meter will not hit $3,343.3$ before the larger number changes and I don't have a match. The next palindrome is $82,028$ and my smaller will read $3,452.3$ and thus I will not have a match.

Question 1: When is the next palindrome match on my odometer?

Question 2: Is there a way to generalize this? For example, if I have a number $ab,cba$ which is a decimal representation whose last digit is the ones digit, and another number $z,yxy.x$, again another decimal representation with the last x being the tenths digit, is there a way to always find the next palindromic match?

EDIT: I changed the wording so now we have odometer and tripmeter.

I like the logic that @BeaumontTaz used to solve. Are they any other methods out there that would also do the trick?

1

There are 1 best solutions below

0
On BEST ANSWER

The only numbers less than $1000$ that you can add to $81818$ to get a palindrome are:

$$100,210,310,410,510,610,710,810,910$$

I came up with this list using the logic:

$$\begin{align} abcba& \\ \underline{+\quad gfe}&\\ \begin{array}{c|c|c|c|c|c} 0&a&b&c+g&b+f&a+e\\ 1&a+1&b+1&c+g+1&b+f+1&\\ \end{array}&\end{align}$$

where the vertical lines break up the digits and each entry is $\pmod{10}$. Now we have a lot of logic statements. We decide between the top and bottom rows as follows. Note I'm counting columns starting at the right.

$$\begin{align}\mathrm{column 2}=&\begin{cases} b+f:& a+e\le9\\ b+f+1:& a+e>9 \end{cases}\\ \mathrm{column 3}=&\begin{cases} c+g:& (b+f\le9)\land(a+e\le9\lor b+f\le8)\\ c+g+1:& (b+f>9)\lor(a+e>9\land b+f>8) \end{cases}\\ \mathrm{column 4}=&\begin{cases} b:& (c+g\le9)\land(b+f\le9\lor c+g\le8)\land(a+e\le9\lor b+f\le8 \lor c+g\le8)\\ b+1:& (c+g>9)\lor(b+f>9\land c+g>8)\lor(a+e>9\land b+f>8 \land c+g>8) \end{cases}\\ \mathrm{column 5}=&\begin{cases} a:& b\ne9\lor((c+g\le9)\land(b+f\le9\lor c+g\le8)\land(a+e\le9\lor b+f\le8 \lor c+g\le8))\\ a+1:& b=9\land ((c+g>9)\lor(b+f>9\land c+g>8)\lor(a+e>9\land b+f>8 \land c+g>8)) \end{cases} \end{align}$$

Basically, these just represent the conditions that can cause us to carry in a particular column.

For our particular case $b=1\ne9$ so we are forced to use $a$ in the fifth column. And in order for this to be a palindrome $a+e=a$ which means that $e=0$.

Now since $e=0$ we know that $a+e\le9$ since $a\le9$ and therefore the second column is $b+f$. We have two cases: $b+f=b$ or $b+f=b+1$ depending on whether we carry into the fourth column or not. First assume we don't have to:

This is $b+f=b$ and again, $f=0$. Since we don't have carrying in the fourth column we know that $(c+g\le9)\land(b+f\le9\lor c+g\le8)\land(a+e\le9\lor b+f\le8 \lor c+g\le8)$ is true. Since $f=e=0$ the two right most statements are true and we just require that $c+g\le 9$ to make the whole statement true. For our case of $c=8$ we know that $g\le1$. So our two cases for no carrying is $000$ and $100$. The only important one is $100$.

Now assume we do have to carry. $b+f=b+1$ which means that $f=1$. And since we carried we require $(c+g>9)\lor(b+f>9\land c+g>8)\lor(a+e>9\land b+f>8 \land c+g>8)$ to be true. The last statement is forced to be false because $e=0$ and therefore $a+0>9$ is false. For us $b=1$ so $b+f=1+1=2$ which is not greater than $9$. So the second statement is false. So we just require the first one to be true. So we say the $c+g>9$ and since $c=8$ we have $g>1$. And that gives us the rest.


We can either just each number on our short list with $3242.3$ to see if we can find a $d$ such that $gfe.d+xyzy.x$ is a palindrome. Or we can use the same logic we did above (created the carry condition tables). I'm getting a little tired of typing these long expressions out. But the end result of doing it this way tells us that $d$ has to be $0$ or $1$ (because we can't ever get the first digit of $3242.3$ to be greater than $4$ without adding a number larger than $1000$. For the case $d=0$ we find that $g=0$ or $g=9$. Since we don't have any cases on the first list with $g=0$ we only have the case $910$. And $910.0$ doesn't result in a palindrome. For the case $d=1$ we find that $y+g>9$ and since $y=2$ we require that $g>7$ So we check $810.1$ and $910.1$ and find they aren't palindromes.


Thus, no number under 1000 can give us a palindrome for both odometers. This same method can be done for $hgfe$ and $hgfe.d$ but would take longer and more patience to finish. I suspect the number Neil gives is the smallest such number. But you'd only have to check $1000,1001,\ldots,1009$ to actually verify that is the smallest.