cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A136047 a(1)=1, a(n)=a(n-1)+n if n even, a(n)=a(n-1)+n^2 if n is odd.

Original entry on oeis.org

1, 3, 12, 16, 41, 47, 96, 104, 185, 195, 316, 328, 497, 511, 736, 752, 1041, 1059, 1420, 1440, 1881, 1903, 2432, 2456, 3081, 3107, 3836, 3864, 4705, 4735, 5696, 5728, 6817, 6851, 8076, 8112, 9481, 9519, 11040, 11080, 12761, 12803, 14652, 14696, 16721
Offset: 1

Views

Author

Zak Seidov, Dec 12 2007

Keywords

Comments

The only prime terms are 3, 41, 47.
The semiprime terms are A136048.
Cf. A001082/A135370: f(1) = 1, then if n even/odd f(n) = n+f(n-1), if n odd/even f(n) = 2*n+f(n-1).

Crossrefs

Programs

  • Mathematica
    a[1]=1;a[n_]:=a[n]=a[n-1]+n^(1+Mod[n,2]); Table[a[n],{n,100}]
    nxt[{n_,a_}]:={n+1,If[OddQ[n],a+n+1,a+(n+1)^2]}; Transpose[NestList[nxt,{1,1},50]][[2]] (* Harvey P. Dale, Oct 11 2015 *)

Formula

a(n) = (1/12)(1 + n)(2n^2+7n-3) if n is odd, a(n)=(1/12)n(2n^2+3n+4) if n is even.
a(n) = (-3 + 3*(-1)^n + 8*n + 12*n^2 - 6*(-1)^n*n^2 + 4*n^3)/24.
a(1)=1 then a(n) = a(n-1)+n^(if n is even then 1 else 2),
or a(n) = a(n-1)+n^(1+mod(n,2)),
or a(n) = a(n-1)+n^((3-(-1)^n)/2).
From R. J. Mathar, Feb 22 2009: (Start)
a(n) = a(n-1)+3*a(n-2)-3*a(n-3)-3*a(n-4)+3*a(n-5)+a(n-6)-a(n-7).
G.f.: x*(1+2*x+6*x^2-2*x^3+x^4)/((1+x)^3*(x-1)^4). (End)

Extensions

Edited by Michel Marcus, Mar 02 2022