vid it's ∑i=1Ni=n(n+1)2\sum_{i=1}^N i=\frac{n(n+1)}{2}∑i=1Ni=2n(n+1)
it's n(n−1)2\frac{n(n-1)}{2}2n(n−1), where there are n−1n-1n−1 rows, same as the number of pairs from a group of nnn.