Syntactic Confectionery Delight | |
PerlMonks |
Re: Re (tilly) 1: Finding sum of all digits from 1 to 1 million.by PrakashK (Pilgrim) |
on Jan 24, 2002 at 00:59 UTC ( [id://141024]=note: print w/replies, xml ) | Need Help?? |
a good exercise would be to write Perl code that efficiently calculates the sum of all of the digits in a range of integers.Assuming sum(n) is the sum of all digits from 1 to n, sum_range(m, n) is the sum of all digits from m to n, and m < n, isn't the following true? Or, did I totally get you wrong? /prakash
In Section
Seekers of Perl Wisdom
|
|