Problem:
An integer between 1000 and 9999, inclusive, is called balanced if the sum of its two leftmost digits equals the sum of its two rightmost digits. How many balanced integers are there?
Solution:
For a balanced four-digit integer, the sum of the leftmost two digits must be at least 1 and at most 18. Let f(n) be the number of ways to write n as a sum of two digits where the first is at least 1 , and let g(n) be the number of ways to write n as a sum of two digits. For example, f(3)=3, since 3=1+2=2+1=3+0, and g(3)=4. Then
f(n)={n19−n​ for 1≤n≤9, for 10≤n≤18,​​
and
g(n)={n+119−n​ for 1≤n≤9 for 10≤n≤18​​
For any balanced four-digit integer whose leftmost and rightmost digit pairs both have sum n, the number of possible leftmost digit pairs is f(n) because the leftmost digit must be at least 1, and the number of possible rightmost digit pairs is g(n). Thus there are f(n)â‹…g(n) four-digit balanced integers whose leftmost and rightmost digit pairs both have sum n. The total number of balanced four-digit integers is then equal to
n=1∑18​f(n)⋅g(n)​=n=1∑9​n(n+1)+n=10∑18​(19−n)2=n=1∑9​(n2+n)+n=1∑9​n2=2n=1∑9​n2+n=1∑9​n=2(12+22+⋯+92)+(1+2+⋯+9)=615​​
The problems on this page are the property of the MAA's American Mathematics Competitions