Monday, August 15, 2016

Sum of Consecutive, Even, Odd and other numbers

Consecutive numbers:
S=N(N+1)/2

*N includes the first element that is why we add 1 at the end

Even numbers:
N= ((Last - First)/2) +1
S= N(N+1)

Odd numbers:
N=((Last-First)/2)+1
S= N^2

Other numbers:
S=Avg * N
N=((Last-First)/Spacing)+1