OFFSET
0,2
COMMENTS
Apart from the first term, numbers of the form (r^2 + 2*s^2)*n^2 + 2 = (r*n)^2 + (s*n - 1)^2 + (s*n + 1)^2: in this case is r = 3, s = 4. After 1, all terms are in A000408.
LINKS
Bruno Berselli, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (3,-3,1).
FORMULA
O.g.f.: (1 + x)*(1 + 39*x + x^2)/(1 - x)^3.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n >= 4. - Wesley Ivan Hurt, Dec 18 2020
E.g.f.: exp(x)*(41*x^2 + 41*x + 2) - 1. - Elmo R. Oliveira, Nov 29 2024
MATHEMATICA
Join[{1}, 41 Range[39]^2 + 2]
CoefficientList[Series[(1 + x) (1 + 39 x + x^2) / (1 - x)^3, {x, 0, 40}], x] (* Vincenzo Librandi, Aug 18 2013 *)
PROG
(Magma) [n eq 0 select 1 else 41*n^2+2: n in [0..39]];
(Magma) I:=[1, 43, 166, 371]; [n le 4 select I[n] else 3*Self(n-1)-3*Self(n-2)+Self(n-3): n in [1..41]]; // Vincenzo Librandi, Aug 18 2013
(PARI) a(n)=if(n, 41*n^2+2, 1) \\ Charles R Greathouse IV, Sep 24 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Bruno Berselli, Feb 07 2012
STATUS
approved