Number theoryDifficulty 5.1AIME, harderFind the answer
Let f(n) be the number of distinct digits of n when written in base 10. Compute the sum of f(n) as n ranges over all positive 2019-digit integers.
A number or a short expression. Spacing and $ signs are ignored.
Solution
Write f(n)=f0(n)+⋯+f9(n) where fd(n)=1 if n contains the digit d and 0 otherwise. The sum of fd(n) over all 2019-digit positive integers n is just the number of 2019-digit positive integers that contain the digit d. For 1≤d≤9, n∑fd(n)=9⋅102018−8⋅92018 Also, n∑f0(n)=9⋅102018−92019 Summing over all possible values of d, we compute n∑f(n)=d=0∑9n∑fd(n)=9(9⋅102018−8⋅92018)+9⋅102018−92019=9(102019−92019)
Want a route through all this instead of an archive? The track
puts 2,000 problems in a working order, from AMC 10 level to the IMO shortlist.
Source: Omni-MATH,
licensed Apache-2.0.
Statement and solution reproduced as published; topic and difficulty added by this site.