login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A140154 a(1)=1, a(n) = a(n-1) + n^3 if n odd, a(n) = a(n-1) + n^2 if n is even. 2
1, 5, 32, 48, 173, 209, 552, 616, 1345, 1445, 2776, 2920, 5117, 5313, 8688, 8944, 13857, 14181, 21040, 21440, 30701, 31185, 43352, 43928, 59553, 60229, 79912, 80696, 105085, 105985, 135776, 136800, 172737, 173893, 216768, 218064, 268717 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
a(n) = a(n-1) + {[1-(-1)^n]/2}*n^3 + {[1+(-1)^n]/2}*n^2, with a(1)=1.
From R. J. Mathar, Feb 22 2009: (Start)
a(n) = a(n-1) + 4*a(n-2) - 4*a(n-3) - 6*a(n-4) + 6*a(n-5) + 4*a(n-6) - 4*a(n-7) - a(n-8) + a(n-9).
G.f.: x*(x^2+1)*(x^4-4*x^3+22*x^2+4*x+1)/((1+x)^4*(1-x)^5). (End)
MAPLE
a:=proc(n) option remember: if n=1 then 1 elif modp(n, 2)<>0 then procname(n-1)+n^3 else procname(n-1)+n^2; fi: end; seq(a(n), n=1..40); # Muniru A Asiru, Jul 12 2018
MATHEMATICA
a = {}; r = 3; s = 2; Do[k = 0; Do[k = k + (Sin[Pi m/2]^2) m^r + (Cos[Pi m/2]^2) m^s, {m, 1, n}]; AppendTo[a, k], {n, 1, 100}]; a (*Artur Jasinski*)
CoefficientList[Series[x*(x^2+1)*(x^4-4*x^3+22*x^2+4*x+1)/((1+x)^4*(1-x)^5), {x, 0, 30}], x] (* G. C. Greubel, Jul 12 2018 *)
nxt[{n_, a_}]:={n+1, If[EvenQ[n], a+(n+1)^3, a+(n+1)^2]}; NestList[nxt, {1, 1}, 40][[All, 2]] (* Harvey P. Dale, Aug 05 2019 *)
PROG
(PARI) x='x+O('x^30); Vec(x*(x^2+1)*(x^4-4*x^3+22*x^2+4*x+1)/((1+x)^4*(1-x)^5)) \\ G. C. Greubel, Jul 12 2018
(Magma) m:=30; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(x^2+1)*(x^4-4*x^3+22*x^2+4*x+1)/((1+x)^4*(1-x)^5))); // G. C. Greubel, Jul 12 2018
(GAP) a:=[1];; for n in [2..40] do a[n]:=a[n-1]+((1-(-1)^n)/2)*n^3+((1+(-1)^n)/2)*n^2; od; a; # Muniru A Asiru, Jul 12 2018
CROSSREFS
Sequence in context: A100840 A265159 A247549 * A350997 A073694 A322952
KEYWORD
nonn
AUTHOR
Artur Jasinski, May 12 2008
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)