OFFSET
0,2
COMMENTS
This is concerned with 2n X 2n square spirals of the form illustrated in the Example section.
LINKS
Index entries for linear recurrences with constant coefficients, signature (4,-6,4,-1).
FORMULA
a(n) = -1 + n + Sum_{k=0..2n} (2k^2 - k + 1) = n -1 +(2*n+1)*(8*n^2-n+3)/3.
a(n) = 2*n^2 + 2*n + (16*n^3 + 2*n)/3 = 2*n*(8*n^2+3*n+4)/3.
G.f.: 2*x*(3*x+5)*(x+1)/(x-1)^4. - Maksym Voznyy (voznyy(AT)mail.ru), Jul 27 2009
EXAMPLE
Example with n = 2:
.
7---8---9--10
| |
6 1---2 11
| | |
5---4---3 12
|
16--15--14--13
.
a(0) = 2(0)^2 + 2(0) + (16(0)^3 + 2(0))/3 = 0;
a(2) = 2(2)^2 + 2(2) + (16(2)^3 + 2(2))/3 = 56.
PROG
(Python) f = lambda n: -1 + n + sum(2*k**2 - k + 1 for k in range(0, 2*n+1))
(Python) a = lambda n: 2*n**2 + 2*n + (16*n**3 + 2*n)/3
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
William A. Tedeschi, Feb 29 2008
STATUS
approved