Problem of the Week - Sino Canada School

Problem of the Week
Problem C and Solution
Palindrome Hunt
Problem
A palindrome is a word, phrase, number, or other sequence of characters which reads the same
backward or forward. Find all seven-digit palindromes that satisfy each of the following conditions:
four of the digits are different; the number is divisible by 45; and the sum of the digits of the number
is 45.
Solution
We will start with the second condition first. For a number to be divisible by 45, it must be
divisible by 5 and 9. For a number to be divisible by 5, the units digit must be either a 0 or 5.
If the units digit is 0, then the first digit of the palindrome would be a 0. The number would
no longer be a seven-digit number. Therefore, the first and last digit of the seven-digit
palindrome must be a 5.
The number looks like 5abcba5 where a 6= b 6= c 6= 5 and 5 + a + b + c + b + a + 5 = 45.
This simplifies to 2a + 2b + c = 35.
The number is divisible by 5. To also be divisible by 9, the sum of the digits must be divisible
by 9.
If we let a = 9 and select values for b so that b < a, then we can generate the following
possibilities:
a
9
9
9
9
9
b
8
7
6
4
3
Number
598c895
597c795
596c695
594c495
593c395
Digit Sum
44 + c
42 + c
40 + c
36 + c
34 + c
Value of c to add to 45
1
3
5
9
none
Valid or Invalid
5981895, valid
5973795, valid
invalid, c cannot equal 5
invalid, c cannot equal a
By switching the positions of a and b in the valid palindrome, we generate two more valid
palindromes, 5891985 and 5793975. Using a = 9 with b = 0, 1, or 2 would produce digit sums
which could not reach 45.
If we let a = 8 and select values for b so that b < a, then we can generate the following
possibilities:
a
8
8
8
b
7
6
4
Number
587c785
586c685
584c485
Digit Sum
40 + c
38 + c
34 + c
Value of c to add to 45
5
7
none
Valid or Invalid
invalid, c cannot equal 5
5867685, valid
By switching the positions of a and b in the valid palindrome, we generate one more valid
palindrome, 5687865. Using a = 8 with b = 0, 1, 2, or 3 would produce digit sums which could
not reach 45.
If we let a = 7 and select values for b so that b < a, then we can generate the following
possibilities:
a
7
7
b
6
4
Number
576c675
574c475
Digit Sum
36 + c
32 + c
Value of c to add to 45
9
none
Valid or Invalid
5769675, valid
Since 5769675 is valid, 5679765 is also valid. Using a = 7 with b = 0, 1, 2, or 3 would produce
digit sums which could not reach 45.
If we let a = 6 and select values for b so that b < a, then we can generate the following
possibility:
a
6
b
4
Number
564c465
Digit Sum
30 + c
Value of c to add to 45
none
Valid or Invalid
Using a = 6 with b = 0, 1, 2, or 3 would produce digit sums which could not reach 45.
We cannot use a = 5 since the digit 5 has already been used.
If we let a = 4 and select values for b so that b < a, no possibilities can be generated. The
maximum value of b is 3. The maximum digit sum in this case is
5 + 4 + 3 + c + 3 + 4 + 5 = 24 + c. There is no possible value of c available so that the digit sum
could equal 45. There are no other remaining possibilities to check.
Therefore, there are 8 valid palindromes which satisfy all of the conditions of the problem.
They are
5981895, 5973795, 5891985, 5793975, 5867685, 576967, 5687865, and 5679765.