in reply to Finding sum of all digits from 1 to 1 million.
Didn't need Math::BigInt, so i would say there is a problem in the code.perl -le "print 1_000_000 * 1_000_001 / 2"
(that formula is one of Guass's, by the way)
UPDATE: details details! :D
seriously, sorry about that,
does this help?
$sum += split('',$_) for (1..1_000_000);
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Finding sum of all digits from 1 to 1 million.
by Anonymous Monk on Jan 24, 2002 at 00:17 UTC |