OFFSET
0,2
COMMENTS
a(n) mod 9 is of period 27.
The spiral:
28--29--29--30--31--31--32
|
27 13--14--15--15--16--17
| | |
27 13 4---5---5---6 17
| | | | |
26 12 3 0---1 7 18
| | | | | |
25 11 3---2---1 7 19
| | | |
25 11--10---9---9---8 19
| |
24--23--23--22--21--21--20
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,-1,1,-2,1).
FORMULA
a(n) = 2*a(n-1) - a(n-2) + a(n-3) - 2*a(n-4) + a(n-5), a(0)=0, a(1)=2, a(2)=5, a(3)=9, a(4)=15.
a(n) = a(n-1) + A004772(n+1), a(0)=0, n>0.
a(n+15) = a(n-15) + 10*A004767(n).
a(-n-1) = ({0} U A000969(n)) = 0, 1, 3, 7, ... = b(n), the full x-axis terms.
a(-n-1) + a(n) = 0, 3, 8, 16, ... = A211480(n+1).
a(n) = b(n) + A004523(n+1).
G.f.: x*(2 + x + x^2) / ((1 - x)^3*(1 + x + x^2)). - Colin Barker, Oct 08 2018
a(n) = A000969(-2-n) for all n in Z. - Michael Somos, Nov 13 2018
EXAMPLE
G.f. = 2*x + 5*x^2 + 9*x^3 + 15*x^4 + 22*x^5 + 30*x^6 + ... - Michael Somos, Nov 13 2018
MAPLE
seq(coeff(series(x^2*(2+x+x^2)/((1-x)^3*(1+x+x^2)), x, n+1), x, n), n = 1 .. 50); # Muniru A Asiru, Oct 08 2018
MATHEMATICA
LinearRecurrence[{2, -1, 1, -2, 1}, {0, 2, 5, 9, 15}, 50] (* or *)
CoefficientList[Series[x*(2 + x + x^2) / ((1 - x)^3*(1 + x + x^2)), {x, 0, 50}], x] (* Stefano Spezia, Oct 09 2018 *)
a[ n_] := Quotient[(n + 1) (2 n + 1), 3]; (* Michael Somos, Nov 13 2018 *)
PROG
(PARI) concat(0, Vec(x*(2 + x + x^2) / ((1 - x)^3*(1 + x + x^2)) + O(x^60))) \\ Colin Barker, Oct 08 2018
(PARI) {a(n) = (n + 1) * (2*n + 1) \ 3}; /* Michael Somos, Nov 13 2018 */
(GAP) a:=[0, 2, 5, 9, 15];; for n in [6..50] do a[n]:=2*a[n-1]-a[n-2]+a[n-3]-2*a[n-4]+a[n-5]; od; a; # Muniru A Asiru, Oct 08 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Curtz, Oct 08 2018
STATUS
approved