Professional Documents
Culture Documents
Tadm2e 2.3 - Algorithm Wiki Functionprestiferous
Tadm2e 2.3 - Algorithm Wiki Functionprestiferous
Tadm2e 2.3 - Algorithm Wiki Functionprestiferous
3 - Algorithm Wiki
TADM2E 2.3
From Algorithm Wiki
2 2
f (n) = (((n )(n + 1) )/8) + n(n + 1)(2n + 1)/12
This problem does appear to break down into a series of nested summations:
n i i+j j+i−k
∑ ∑ ∑ ∑ 1
In the last summation, the formula is independent of the iterator, which translates into adding the value 1,
j + i − k times:
n i i+j
∑ ∑ ∑(j + i − k)
Now the third summation goes from j to i + j the formula on closer examination reveals that
i+j i
end end−start
k=start k=1
n i
∑ ∑(i ∗ (i + 1)/2)
i=1 j=1
The formula in the second summation is independent of the iterator, which translates to adding i ∗ (i + 1)/2 , i
times.
n
2
∑(i ∗ (i + 1)/2)
i=1
which is
n
3 2
∑((i + i )/2)
i=1
http://www.algorist.com/algowiki/index.php/TADM2E_2.3 1/2
2/2/2019 TADM2E 2.3 - Algorithm Wiki
2 2
2 2
1 1 n (n+1) n(n+1)(2n+1) n (n+1) n(n+1)(2n+1)
3 2
(Σr + Σr ) = ( + ) = +
2 2 4 6 8 12
http://www.algorist.com/algowiki/index.php/TADM2E_2.3 2/2