This is mostly in jest but it does illustrate that programmer knowledge of the specific task at hand is more valuable then generalizations. There are similar formulas for summing just the odd or even numbers from 1 .. N as well.use Math::BigInt; my $sum = Math::BigInt->new(2); $sum->bpow(30); $sum = ($sum * $sum + $sum) / 2; print $sum; __DATA__ 576460752840294400
Cheers - L~R
In reply to Re^3: &1 is no faster than %2 when checking for oddness. Oh well.
by Limbic~Region
in thread &1 is no faster than %2 when checking for oddness. Oh well.
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |