SOLUTION: How many integers are there between 1 and 1 000 000 whose sum of digits add up to 25?

Algebra ->  Permutations -> SOLUTION: How many integers are there between 1 and 1 000 000 whose sum of digits add up to 25?      Log On


   



Question 1133940: How many integers are there between 1 and 1 000 000 whose sum of digits add up to 25?
Found 2 solutions by math_helper, MathTherapy:
Answer by math_helper(2461) About Me  (Show Source):
You can put this solution on YOUR website!

53262


To see just the count:

perl -e '$c=0; $s=0; for($i=1; $i<1000001; $i++) { @w = split(//,"$i"); for($j=0,$s=0;$j<$#w+1;$j++) { $s+=$w[$j]; } if ($s == 25) { $c++; } } print "count = $c\n";'


To see them all, run this:

perl -e '$c=0; $s=0; for($i=1; $i<1000001; $i++) { @w = split(//,"$i"); for($j=0,$s=0;$j<$#w+1;$j++) { $s+=$w[$j]; } if ($s == 25) { $c++; print "$i\n"; } } print "count = $c\n";'


Answer by MathTherapy(10552) About Me  (Show Source):
You can put this solution on YOUR website!
How many integers are there between 1 and 1 000 000 whose sum of digits add up to 25?
I agree with @MATH_HELPER. He's right "on target."
I did an Excel spreadsheet that summed the digits of numbers starting at 799 - which is the lowest number to have digits that sum
to 25 - and ending at 999,999. I did a count (Excel function) and it is indeed a total of 53,262 numbers with digits that sum to 25.