Spring 2008 — 9 Three Palindromes
A palindrome is a number that reads the same backwards and forwards (for example, 123321). We will say that palindromes are consecutive if there are no palindromes between them (thus 99, 101, 111 is a sequence of consecutive palindromes).
Find three consecutive palindromes a, b, and c, such that the difference between c and b is 5 million times greater than the difference between b and a.
Solution
Jared Latiolais earned five points for the first correct answer:
a = 99,999,999,999,999
b =100,000,000,000,001
c = 100,000,010,000,001
(c-b) = (b-a)*5,000,000
is true for these values. a and b are consecutive palindromes because the one number between them is not a palindrome. b and c are consecutive because c is the first palindrome greater than b that has a digit at or to the left of its middle that is not the same as the digits at or to the left of b. This means that it is also the first palindrome that is greater than b.
Paul Ottoway gave a detailed explanation:
To construct such a set, we can begin by considering very small values for b-a. This difference can be 1 if they are single digits, but this doesn't lead to such a triple. If b-a=2, however, we can let a be any number which is a sequence of 9s which would make b 10^k+1. In this case, c-b is 10000000. In order to have such a difference, we would need b to be a 15 digit palindrome where the middle digit is not a 9. This has already been satisfied, so we get the triple:
a = 10^15-1
b = 10^15+1
c = 10^15+10^8+1Furthermore, we can prove that this is the only triple which satisfies the given property. In order that a pair of consecutive palindromes have a difference of a multiple of 5000000, they must have an odd number of digits and there can be no carrying when you consider the sum b + 5000000*(b-a). Now, if b and a have the same number of digits, then the difference between them must be at least 1000000 (since they will have at least 13 digits each). This will make the difference between c and b too large to be consecutive. Therefore, a and b must have a different number of digits. The only time consecutive palindromes have a different number of digits is exactly in the situation described above with b-a=2.
And Mark Goadrich wrote a Python program:
a = 99999999999999
b = 100000000000001
c = 100000010000001I started with a python program to iterate through all numbers, keeping track of consecutive palindromes and checking if they satisfied the above equation. This was taking way too long.
So I traced the number (c-b) / (b-a) for each consecutive set of palindromes and noticed a few patterns, starting with the hint shown above
99, 101, 111 = 5
9999, 10001, 10101 = 50
999999, 1000001, 1001001 = 500So I initialized my program to 99999999999999 for the initial index, and it guaranteed that there were no intervening palindromes between the sequence presented above, making them consecutive.
