OFFSET
1,1
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
G.f.: x(x^5+3x^4-x^3+2x^2+2x+3)/(1-x^2)^3. - N. J. A. Sloane, Jun 12 2004
EXAMPLE
a(3) = 11 because the continued fraction for the square root of 11 is 3, {3, 6}.
MATHEMATICA
Table[If[OddQ[n], n^2 + 2, (n/2)^2 + 1], {n, 100}] (* T. D. Noe, Feb 28 2012 *)
PROG
(PARI) a(n)=if(n%2, n^2+2, (n/2)^2+1) \\ Charles R Greathouse IV, Aug 09 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved