Keep It Simple, Stupid  
PerlMonks 
Re: Finding sum of all digits from 1 to 1 million.by vagnerr (Prior) 
on Jan 24, 2002 at 00:17 UTC ( #141011=note: print w/ replies, xml )  Need Help?? 
I think you may be right. I don't think the answer you have is correct. There is actualy a formula to calculate the sum of the numbers from 1n. It is (n^2)/2 + n/2 which in the case of n=1000000 the answer is 500000500000
In Section
Seekers of Perl Wisdom

