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.

A030118 a(0) = 1, a(1) = 1, a(n) = a(n-1) - a(n-2) + n.

Original entry on oeis.org

1, 1, 2, 4, 6, 7, 7, 7, 8, 10, 12, 13, 13, 13, 14, 16, 18, 19, 19, 19, 20, 22, 24, 25, 25, 25, 26, 28, 30, 31, 31, 31, 32, 34, 36, 37, 37, 37, 38, 40, 42, 43, 43, 43, 44, 46, 48, 49, 49, 49, 50, 52, 54, 55, 55, 55, 56, 58, 60, 61, 61, 61, 62, 64, 66, 67, 67, 67, 68, 70, 72, 73
Offset: 0

Views

Author

Keywords

Comments

Contains all positive integers except for 3 mod 6 and 5 mod 6 (A047270). - Jon Perry, Nov 02 2014

Crossrefs

Programs

  • GAP
    Concatenation([1], List([1..80], n-> n+1 - ((-1)^Int((n-1)/3) + (-1)^Int(n/3))/2 )); # G. C. Greubel, Jul 24 2019
  • Magma
    [1] cat [n le 2 select (n) else n + Self(n-1)-Self(n-2): n in [1..80]]; // Vincenzo Librandi, Nov 02 2014
    
  • Maple
    A:= gfun:-rectoproc({a(n)=a(n-1)-a(n-2)+n , a(0)=1,a(1)=1},a(n),remember):
    seq(A(n),n=0..80); # Robert Israel, Nov 02 2014
  • Mathematica
    Table[n+1 -((-1)^Floor[(n-1)/3] +(-1)^Floor[n/3])/2, {n, 0, 80}] (* G. C. Greubel, Jul 24 2019 *)
    nxt[{n_,a_,b_}]:={n+1,b,b-a+n+1}; NestList[nxt,{1,1,1},80][[;;,2]] (* or *) LinearRecurrence[{3,-4,3,-1},{1,1,2,4},80] (* Harvey P. Dale, May 16 2025 *)
  • PARI
    vector(80, n, n--; n+1 - ((-1)^floor((n-1)/3) + (-1)^floor(n/3))/2) \\ G. C. Greubel, Jul 24 2019
    
  • Sage
    [lucas_number1(n+1,2,1)-lucas_number1(n,1,1) for n in range(0, 80)] # Zerinvary Lajos, Nov 10 2009
    

Formula

a(
G.f.: (1-2*x+3*x^2-x^3)/((1-x+x^2)*(1-x)^2). - Robert Israel, Nov 02 2014
a(n) = n iff n is either 1 or 2 mod 6. - Jon Perry, Nov 02 2014
a(n) = n + 1 - ((-1)^floor((n-1)/3) + (-1)^floor(n/3))/2) = n + 1 - A010892(n+5). - G. C. Greubel, Jul 24 2019
For k >= 1, a(6*k-1) = a(6*k) = a(6*k+1) = 6*k+1; a(6*k+2) = 6*k+2; a(6*k+3) = 6*k+4; a(6*k+4) = 6*k+6. - Bernard Schott, Jul 24 2019
a(n) = 3*a(n-1) - 4*a(n-2) + 3*a(n-3) - a(n-4) for n > 3. - Chai Wah Wu, Jun 30 2020

Extensions

More terms from Erich Friedman