OFFSET
0,3
COMMENTS
n X n spirals of the form: (Examples of n = 3, 4)
7...8...9
6...1...2
5...4...3
and
7...8...9...10
6...1...2...11
5...4...3...12
16..15..14..13
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (3,-2,-2,3,-1).
FORMULA
a(n) = mod(n^(n+1),n+1) + floor(n/2)^2*(6-4(-1)^n) + [16*floor(n/2)^3 + floor(n/2)*(14-12(-1)^n)]/3
Empirical G.f.: x*(1+7*x-3*x^2+3*x^3)/((1-x)^4*(1+x)). - Colin Barker, Jan 12 2012
From Robert Israel, Jun 25 2019: (Start)
a(n) = 2*n^3/3 + n^2/2 + 4*n/3 + 3*((-1)^n -1)/4. (End)
E.g.f.: (x*(15 + 15*x + 4*x^2)*cosh(x) - (9 - 15*x - 15*x^2 - 4*x^3)*sinh(x))/6. - Stefano Spezia, May 17 2026
EXAMPLE
a(1) = mod(1^(1+1),1+1) + floor(1/2)^2*(6-4(-1)^1) + [16*floor(1/2)^3 + floor(1/2)*(14-12(-1)^1)]/3 = 1
a(2) = mod(2^(2+1),2+1) + floor(2/2)^2*(6-4(-1)^2) + [16*floor(2/2)^3 + floor(2/2)*(14-12(-1)^2)]/3 = 10
MAPLE
f:= n -> 2*n^3/3 + n^2/2 + 4*n/3 + 3*((-1)^n -1)/4:
map(f, [$0..100]); # Robert Israel, Jun 25 2019
MATHEMATICA
LinearRecurrence[{3, -2, -2, 3, -1}, {0, 1, 10, 25, 56}, 50] (* Paolo Xausa, May 16 2026 *)
PROG
(PARI) a(n) = (4*n^3 + 3*n^2 + 8*n - n%2*9)/6 \\ Charles R Greathouse IV, May 16 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
William A. Tedeschi, Feb 29 2008
STATUS
approved
