Can anyone suggest an elegant way to sum a series of numbers like this:
(1, 2, 3, 4)
(2, 3, 4, 5)
(3, 4, 5, 6)
(4, 5, 6, 7)
That is for $n$ sets of $d$ numbers, what is the total of all numbers?
For example in the series above, the total should be 64
For n sets of d numbers, there must be an average number. If all of the rows increment by 1 then you could just take the average of the two corners, top left and bottom right to get the average for all spots.
Example:
Average of $1$ and $7$ (rows+columns-1) is $4$ (which is always $(n+d-1+1)/2$)
$4$ (average) times $4$ (rows) times $4$(columns) is $64$
So the total is $\frac{n+d}{2}*n*d$ if it always increments by one for ever row and column and it starts at one at the top left corner.