laziness, impatience, and hubris | |
PerlMonks |
Re: (jeffa) Re: Finding sum of all digits from 1 to 1 million.by Anonymous Monk |
on Jan 24, 2002 at 00:17 UTC ( [id://141012]=note: print w/replies, xml ) | Need Help?? |
That tells you the sum of all integers from 1 to 1 million. It doesn't give you the sum of all the digits in those numbers.
To illustrate the difference:
The sum of all numbers from 1 to 15 is 105 (1 + 2 + 3...+15)
The sum of all digits in those numbers is 66
(1 + 2 + 3...+ (1 + 0)... + (1+ 5))
-Beth
In Section
Seekers of Perl Wisdom
|
|