OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
a(2*n-1) = 2*n^2, a(2*n) = 2*n^2 + 2*n + 1, for n > 4.
From Wesley Ivan Hurt, Aug 03 2015: (Start)
G.f.: x*(1+x^2+x^3-x^4+3*x^5-3*x^6-2*x^9+2*x^10)/((1-x)^3*(1+x)).
a(n) = ceiling((n+1)^2/2) = A000982(n+1), for n > 7. (End)
MAPLE
A090937:=n->(2*n^2+4*n+3+(-1)^n)/4: (1, 2, 5, 9, 14, 23, 30, seq(A090937(n), n=8..100)); # Wesley Ivan Hurt, Aug 03 2015
MATHEMATICA
lst = {}; a = 2; Do[d = n; While[! CoprimeQ[a, d], d++]; a = a + d; AppendTo[lst, a], {n, 3, 53}]; Join[{1, 2}, lst] (* Arkadiusz Wesolowski, Jun 03 2013 *)
nxt[{n_, a_}]:=Module[{k=n+1}, While[!CoprimeQ[a, k], k++]; {n+1, a+k}]; Join[ {1}, Transpose[NestList[nxt, {2, 2}, 60]][[2]]] (* Harvey P. Dale, Apr 07 2015 *)
CoefficientList[Series[(1+x^2+x^3-x^4+3x^5-3x^6-2x^9+2x^10)/((1-x)^3*(1+ x)), {x, 0, 50}], x] (* or *) Join[{1, 2, 5, 9, 14, 23, 30}, Table[(2n^2 +4n + 3 +(-1)^n)/4, {n, 8, 100}]] (* Wesley Ivan Hurt, Aug 03 2015 *)
PROG
(PARI) my(x='x+O('x^60)); Vec(x*(1+x^2+x^3-x^4+3*x^5-3*x^6-2*x^9+2*x^10 )/((1-x)^3*(1+x))) \\ G. C. Greubel, Feb 04 2019
(Magma) m:=60; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!( x*(1+x^2+x^3-x^4+3*x^5-3*x^6-2*x^9+2*x^10 )/((1-x)^3*(1+x)) )); // G. C. Greubel, Feb 04 2019
(Sage) a=(x*(1+x^2+x^3-x^4+3*x^5-3*x^6-2*x^9+2*x^10 )/((1-x)^3*(1+x)) ).series(x, 60).coefficients(x, sparse=False); a[1:] # G. C. Greubel, Feb 04 2019
(GAP) Concatenation([1, 2, 5, 9, 14, 23, 30], List([8..60], n -> (2*n^2 +4*n +3 +(-1)^n)/4)); # G. C. Greubel, Feb 04 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, Dec 29 2003
EXTENSIONS
Name changed and sequence extended by Arkadiusz Wesolowski, Jun 03 2013
STATUS
approved