A140113 a(1)=1, a(n)=a(n-1)+n if n odd, a(n)=a(n-1)+ n^2 if n is even.
1, 5, 8, 24, 29, 65, 72, 136, 145, 245, 256, 400, 413, 609, 624, 880, 897, 1221, 1240, 1640, 1661, 2145, 2168, 2744, 2769, 3445, 3472, 4256, 4285, 5185, 5216, 6240, 6273, 7429, 7464, 8760, 8797, 10241, 10280, 11880, 11921, 13685, 13728, 15664, 15709
Offset: 1
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1).
Crossrefs
Cf. A136047.
Programs
-
Mathematica
nxt[{n_,a_}]:={n+1,If[EvenQ[n],a+n+1,a+(n+1)^2]}; Transpose[ NestList[ nxt,{1,1},50]][[2]] (* or *) LinearRecurrence[{1,3,-3,-3,3,1,-1},{1,5,8,24,29,65,72},50] (* Harvey P. Dale, Jul 22 2014 *) CoefficientList[Series[(- x^4 + 4 x^3 + 4 x + 1)/(x^7 - x^6 - 3 x^5 + 3 x^4 + 3 x^3 - 3 x^2 - x + 1), {x, 0, 40}], x] (* Vincenzo Librandi, Jul 23 2014 *)
-
PARI
print1(a=1);for(n=2,99,print1(", ",a+=n^(2-n%2))) \\ Charles R Greathouse IV, Jul 19 2011
Formula
O.g.f.: (-x^4 + 4*x^3 + 4*x + 1)/(x^7 - x^6 - 3*x^5 + 3*x^4 + 3*x^3 - 3*x^2 - x + 1). - Alexander R. Povolotsky, May 08 2008
Comments