Browse · MathNet
PrintEstonian Mathematical Olympiad
Estonia counting and probability
Problem
A number is called a palindrome if reversing its digits results in the exact same number. Given an integer , how many -digit natural numbers are there such that when added to the number obtained by reversing the order of its digits, the result is a palindrome?
Solution
Let be an -digit number such that the sum of the number with the number obtained by reversing its digits is a palindrome. We consider two cases separately.
If the sum is an -digit number, then obviously . We show that no carry occurs when adding the numbers and . Suppose, to the contrary, that a carry occurs. Let the result of the addition be the number , with the first carry occurring in the -th position from the end. Then , , , and . Due to the last inequality, a carry also occurs in the -th position from the end. Therefore, . But for to be a palindrome, the equality must hold, which is a contradiction.
If the sum is a -digit number, its first digit must be 1; let the remaining digits of the sum be . We will show that for each , either or . The statement is obviously true for , since , but due to , . Now let and assume that the statement holds for . Consider the case . Depending on whether or not there is a carry in the -th position from the end, or . Accordingly, or , that is, or . Since there is a carry in the -th position from the end, the last digit of must be 1 or 0, respectively. Similarly, in the case , depending on whether or not there is a carry in the -th position from the end, or . Accordingly, or , that is, or . Since there is no carry in the -th position from the end, the last digit of is 1 or 0, respectively. In conclusion, we have shown that if there is a carry in the -th position from the end, the last digit of is 1, and if there is no carry in the -th position from the end, the last digit of is 0. In the first case, , and in the second case, . This completes the induction step and proves the desired statement.
All described numbers trivially satisfy the problem's condition. Let's count them. If is even, the number of -digit numbers for which no carry occurs when adding the number and the number obtained by reversing its digits is , because the number of pairs of digits whose sum is less than 10 is or 36, when zero is not allowed (as in the first and last positions), and or 55, when zero is allowed (as in the other positions). The number of -digit numbers for which the sum of the first and last digits is 11 and the sum of the digits equidistant from the middle is either 0 or 11 is . Similarly, if is odd, the number of -digit numbers for which no carry occurs when adding the number and the number obtained by reversing its digits is . The number of -digit numbers for which the sum of the first and last digits is 11 and the sum of the digits equidistant from the middle is either 0 or 11 is . Thus, the total number of such numbers is if is even and if is odd.
If the sum is an -digit number, then obviously . We show that no carry occurs when adding the numbers and . Suppose, to the contrary, that a carry occurs. Let the result of the addition be the number , with the first carry occurring in the -th position from the end. Then , , , and . Due to the last inequality, a carry also occurs in the -th position from the end. Therefore, . But for to be a palindrome, the equality must hold, which is a contradiction.
If the sum is a -digit number, its first digit must be 1; let the remaining digits of the sum be . We will show that for each , either or . The statement is obviously true for , since , but due to , . Now let and assume that the statement holds for . Consider the case . Depending on whether or not there is a carry in the -th position from the end, or . Accordingly, or , that is, or . Since there is a carry in the -th position from the end, the last digit of must be 1 or 0, respectively. Similarly, in the case , depending on whether or not there is a carry in the -th position from the end, or . Accordingly, or , that is, or . Since there is no carry in the -th position from the end, the last digit of is 1 or 0, respectively. In conclusion, we have shown that if there is a carry in the -th position from the end, the last digit of is 1, and if there is no carry in the -th position from the end, the last digit of is 0. In the first case, , and in the second case, . This completes the induction step and proves the desired statement.
All described numbers trivially satisfy the problem's condition. Let's count them. If is even, the number of -digit numbers for which no carry occurs when adding the number and the number obtained by reversing its digits is , because the number of pairs of digits whose sum is less than 10 is or 36, when zero is not allowed (as in the first and last positions), and or 55, when zero is allowed (as in the other positions). The number of -digit numbers for which the sum of the first and last digits is 11 and the sum of the digits equidistant from the middle is either 0 or 11 is . Similarly, if is odd, the number of -digit numbers for which no carry occurs when adding the number and the number obtained by reversing its digits is . The number of -digit numbers for which the sum of the first and last digits is 11 and the sum of the digits equidistant from the middle is either 0 or 11 is . Thus, the total number of such numbers is if is even and if is odd.
Final answer
If n is even: 36 55^{(n-2)/2} + 8 9^{(n-2)/2}. If n is odd: 36 55^{(n-3)/2} 5 + 8 * 9^{(n-3)/2}.
Techniques
Enumeration with symmetryInduction / smoothing