Closed captainredbleach closed 2 years ago
The formula is correct as stated. Note that range(n)
contains the numbers 0
to n-1
, not 1
to n
. You can verify the answer by checking the output of sum(range(n))
for small values of n
, or by plugging in n-1
into the formula you provided.
Fixes a small error in sum_math. Instead of a minus, it should be a plus to give the correct answer