Digits adding to nineteen
How many positive integers less than 1,000,000 have decimal digits that add up to 19?
Fractions, decimals with at least 3 significant digits, and expressions such as sqrt(2)/2, e^-1 or pi/4.
Write each number with exactly six digits, padding with zeros. You are counting solutions of with each between 0 and 9.
Count without the upper limit (stars and bars), then remove the solutions where some digit is 10 or more. At most one digit can be that large.
h
s Shown after a correct answer. Revealing it first marks the problem as seen, not solved.
Idea. Count digit strings with stars and bars, then subtract the strings where a “digit” is 10 or more. Since , at most one digit can break the rule, so a single correction is enough.
Step 1: without the cap. The number of solutions of in nonnegative integers is
Step 2: too-large digits. If , write : then , with solutions. The same for each of the 6 positions, and two digits cannot both be 10 or more. So subtract .
Step 3.
Padding with zeros is harmless: every positive integer below a million corresponds to exactly one six-digit string, and the string 000000 has digit sum 0, so it is not counted.