in reply to Re^2: A script with a loop is running my computer Out of memory
in thread A script with a loop is running my computer Out of memory
Dunno if it matters, but
0 + 1 + 2 + .. + ($n-1)
can be calculated using
$n * ($n-1) / 2
So
( 0 + 1 + 2 + .. + ($n-1) ) / $n
is simply
($n-1) / 2
|
|---|