Last week's Car Talk question was again of mathematical interest - it dealt with palindromic numbers on a car's odometer. (This is not the first palindromic odometer question they've done.)

Read Car Talk's "Tommy's Drive to Work" puzzler question

Short version:

Tommy goes for a short drive (under an hour; possibly well under an hour) in his 19-year old new car. He notices that the odometer reading at the beginning and the end of the drive are both palindromes (we're given that his odometer shows six digits.) The question is, how many miles did he drive?

You're *supposed* to do a bunch of math, and then experience an epiphany when you realize that, against all odds, there's a single unique answer, even though the odometer readings themselves cannot be uniquely determined.

Alas, the problem is flawed. There are two perfectly good (and different) answers.

## The intended answer

The first reading is given as a palindrome - the first three digits (let's call them *a*, *b*, *c*) are the same as the last three digits in reverse (*c*, *b*, *a*). So we can write the first number as *abccba*.

The second reading is also given as a palindrome, and we're given that it's a *different* palindrome (we infer that the odometer is not broken, and he drove at least a mile.) So we can write the second number as *xyzzyx*.

We want to find whether it's possible to get these two readings while driving a reasonably small distance. The distance driven is the difference between the odometer readings: *xyzzyx* – *abccba*.

*xyzzyx* – *abccba*

= (100001 *x* + 10010 *y* + 1100 *z*) – (100001 *a* + 10010 *b* + 1100 *c*)

= 100001 (*x* – *a*) + 10010 (*y* – *b*) + 1100 (*z* – *c*)

Because *xyzzyx* > *abccba*, we know that *x* ≥ *a*. Also, if *x* = *a*, we know that *y* ≥ *b*. Finally, if *x* = *a* and *y* = *b*, we know that *z* > *c* (*z* cannot equal *c* in this case.) Let's look at these three cases separately.

**Case 1: x = a, y = b, z > c**

*xyzzyx*–

*abccba*

= 100001 (

*x*–

*a*) + 10010 (

*y*–

*b*) + 1100 (

*z*–

*c*)

= 100001 (0) + 10010 (0) + 1100 (

*z*–

*c*)

= 1100 (

*z*–

*c*)

*z* and *c* can range from 0 to 9, and *z* > *c*, so (*z* – *c*) can range from 1 to 9. So the smallest the distance can be is 1100 miles - for example, 250052 → 259952 (1100 miles.) This is a bit far for an hour's drive.

**Case 2: x = a, y > b, no conditions imposed on z vs. c**

*xyzzyx*–

*abccba*

= 100001 (

*x*–

*a*) + 10010 (

*y*–

*b*) + 1100 (

*z*–

*c*)

= 100001 (0) + 10010 (

*y*–

*b*) + 1100 (

*z*–

*c*)

= 10010 (

*y*–

*b*) + 1100 (

*z*–

*c*)

*y*, *b*, *z*, and *c* can range from 0 to 9; *y* > *b*; and no conditions are imposed on *z* vs. *c*. (*y* – *b*) can range from 1 to 9, (*z* – *c*) can range from -9 to 9. So the smallest the distance can be is 100101 + 1100 (-9) = 110 miles - for example, 379973 → 380083 (110 miles.) It's certainly possible to drive 110 miles in an hour but not without attracting the attention of the local police!

**Case 3: x > a, no conditions imposed on y vs. b or z vs. c**

*xyzzyx*–

*abccba*

= 100001 (

*x*–

*a*) + 10010 (

*y*–

*b*) + 1100 (

*z*–

*c*)

*x*, *a*, *y*, *b*, *z*, and *c* can range from 0 to 9; *x* > *a*; and no conditions are imposed on *y* vs. *b*, or *z* vs. *c*. (*x* – *a*) can range from 1 to 9, (*y* – *b*) and (*z* – *c*) can range from -9 to 9. So the smallest the distance can be is 100001 (1) + 10010 (-9) + 1100 (-9) = 11 miles - for example, 499994 → 500005 (11 miles.) This is much more reasonable.

The intended answer, then, is **11 miles**. There are 9 possible ways to get this distance with palindromic starting and ending readings:

099990 → 100001 (11 miles)

199991 → 200002 (11 miles)

299992 → 300003 (11 miles)

399993 → 400004 (11 miles)

499994 → 500005 (11 miles)

599995 → 600006 (11 miles)

699996 → 700007 (11 miles)

799997 → 800008 (11 miles)

899998 → 900009 (11 miles)

## Not a flaw

Do we consider numbers with unmatched leading zeros (like 001221) to be palindromes? I would say no. If we did this, it would open up a whole new field of answers such as 77 → 101 (24 miles.) The problem statement seems to imply that all six digits of the number, including leading zeros, need to participate in the palindrome. We can probably infer that Tommy's odometer is an analog odometer that actually shows leading zeros, rather than a digital odometer which hides them; this is consistent with the car being 19 years old.

## The flaw

All well and good. Alas, there's a flaw in this beautiful analysis - namely, *odometers wrap.* It's entirely possible for the assumption that *xyzzyx* > *abccba* to break down if Tommy started his drive with a number close to 999999, and his odometer wrapped around to 000000 during the drive.

In fact, this leads to the second reasonable answer:

999999 → 000000 (1 mile.)

There are other "wrapped" palindromes, but the next smallest are 998899 → 000000 (1101 miles) and 999999 → 001100 (1101 miles) which are even worse than case 1.

Could a 19-year-old car have a million miles on it?

That comes out to an average of 144.1 miles a day, which is high, but achievable (it's only 6 mph.) It's true that Tommy is unlikely to have put this many miles on a car if he lives only a mile from work, but remember that this is his *new* car (that is, it only recently came into his possession.)