How many numbers between 0 and 1,000 have the sum of their digits equal to 15 or less?
I went about this a rather long route looking case by case and I noticed a pattern. Between 0 and 99 I found 5 cases that didn't work, between 100 and 199 10 cases that didn't work, between 200 and 299 15 cases that didn't work... etc
I got my final answer to be 725. Can someone confirm my solution?
$79$ doesn't work, youve probably missed that one, because between $0-100$ there are 6 exceptions. $$99,98,97,89,88,79$$ Group them by 10s. When we go to the next hundred, (i.e. $101-200$), each group of 10s will have one extra term added(so $99,98,97$ will become $199,198,197,196$, etc) and one extra group is added ($169$).
So between $101-200$, we have: $$199,198,197,196,189,188,187,179,178,169$$
This pattern means you start with $6$ (for $0-100$) and add 4 (for $101-200$) then 5 then 6 etc, and holds up until $800$.
After $800$, the groups cross over and the pattern fails, however by sorting by $10s$ you can figure out that between 800 and 900 there are $64$ exceptions and between 900 and 1000 there are 72. This is because the pattern starts ruling out entire groups of 10s. In total the number of exceptions is $6+10+15+21+28+36+45+55+64+72=352$, or $649$ $(1001-352)$ which meet your requirement.
Here is a summary of working out exceptions for $800-900$ (the same can be applied to $900-1000$)
Exceptions: $$890-899=10$$ $$880-889=10$$ $$870-879=9$$ $$860-869=8$$ $$850-859=7$$ $$840-849=6$$ $$830-839=5$$ $$820-829=4$$ $$810-819=3$$ $$800-809=2$$ Sum of exceptions =$10+10+9+8+7+6+5+4+3+2=64$