sum (sum j, j=1 to n-i), i=1 to n-1