Where a[t] = bn
d[t - 1] - d = b(n-1)
Where a[t] = bn
d[t - 1] - d = b(n-1)
Correcting my correction
My x to t, t to x calculation was wrong, and because of that a[p - t - 1] worked fine for me, not a[p + 1 - t].
So to add more usefulness and to keep things in one place:
Odd e: x = 2t - 1
Even e: x = 2(t-1)
Since we're dealing with series here, I'm adding a few things regarding them.
To sum all the a's in a column, row 1:
odd e: n(e/2 + 1) + 2((n-1)n(n+1)/3)
even e: ne/2 + 2(n(n+1)(2n+1)/6)
The sum of d's in a column, row 1:
even e: n(e/2 + 1) + 2(n(n+1)(2n+1)/6)
odd e: ne/2 + 2((n-1)n(n+1)/3)
To get a partial sum, that is a sum between nth and nth + k (for some nth and k)
s1 = sum(e, k)
s2 = sum(e, nth - 1)
return s1 - s2