OFFSET
1,1
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = n^2 + O(n). - Charles R Greathouse IV, Nov 20 2014
G.f.: x*(5+8*x-6*x^2+x^4)/((1+x)^2*(1-x)^3). [Bruno Berselli, Dec 02 2014]
a(n) = (2*n*(n+5)-(2n+1)*(-1)^n+11)/2. [Bruno Berselli, Dec 02 2014]
MATHEMATICA
fn[n_]:=Module[{c=4n^2+1}, {c, c+8n}]; Flatten[Array[fn, 30]] (* or *) LinearRecurrence[{1, 2, -2, -1, 1}, {5, 13, 17, 33, 37}, 60] (* Harvey P. Dale, May 21 2015 *)
PROG
(PARI) list(lim)=Set(concat(vector(sqrtint((lim-1)\4), n, 4*n^2+1), vector(sqrtint(lim\1+3)\2-1, n, 4*n^2+8*n+1))) \\ Charles R Greathouse IV, Nov 13 2014
(PARI) a(n)=if(n%2, (n+1)^2+1, n^2+4*n+1) \\ Charles R Greathouse IV, Nov 20 2014
(Magma) [IsEven(n) select n^2+4*n+1 else (n+1)^2+1: n in [1..50]]; // Bruno Berselli, Dec 02 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jamel Ghanouchi, Nov 13 2014
EXTENSIONS
Extended by Charles R Greathouse IV, Nov 13 2014
STATUS
approved