A palindrome is a positive integer whose digits are the same when read forwards or backwards. There are pairs of four digits palindrome whose sum is a five digits palindrome. One such pair is 2882 and 9339. How many such pairs are there?

1 Answer
Dec 18, 2017

There are 72 ordered pairs or 36 unordered pairs.

Explanation:

The first palindrome is
1000a+100b+10b+a=1001a+110b
and the second is
1001c+110d
where a,b,c,d are digits and a,c!=0

The sum 1001(a+c)+110(b+d) has 5 digits and first digit is at most 1 (even if a,b,c,d are all 9). It means that last digit is also 1.

Therefore a+c=1 or a+c=11, but it can't be 1, because both a and c are nonzero. Thus a+c=11.
Plugging it in the expression gives 11011+110(b+d)

Now there are a few possibilities:

  • for b+d=0 it's a palindrome (it basically means, that b=d=0)
  • for 1<=b+d<=8 it's not a palindrome (try it)
  • for b+d=9 it's 11011+990=12001, not a palindrome

Now we can see that adding 110 again and again gives a palindrome 12221 at b+d=11 and reaches 12991 for b+d=18.

There's 8 ordered pairs of digits that satisfy x+y=11. (try counting from 2+9 to 9+2). For our palindromes there are two solutions:
a+c=11,b=d=0
or
a+c=b+d=11
The first one has 8 possibilities, and the second has 8*8=64 possibilities. that gives a total of 72 ordered pairs.

If we want unordered pairs we must divide this number by 2. (The procedure would be more sophisticated when there are pairs of equal palindromes, but it's not possible in this scenario, because sum is odd)

You can see your example 2882+9339=12221 belongs to the second category.