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.

A187093 a(0)=0, a(1)=a(2)=1; thereafter, a(n+1) = n^2 - a(n-1).

Original entry on oeis.org

0, 1, 1, 3, 8, 13, 17, 23, 32, 41, 49, 59, 72, 85, 97, 111, 128, 145, 161, 179, 200, 221, 241, 263, 288, 313, 337, 363, 392, 421, 449, 479, 512, 545, 577, 611, 648, 685, 721, 759, 800, 841, 881, 923, 968, 1013, 1057, 1103, 1152, 1201, 1249, 1299, 1352, 1405, 1457
Offset: 0

Views

Author

Benjamin Coinsin, Mar 04 2011

Keywords

Comments

The original definition was equivalent to: Let S(n) = sum_{i=0..n} a(i), then n^2+a(n)-S(n+1) = S(n-2). This in turn simplifies to the present definition.

Crossrefs

Programs

  • Maple
    A000034 := proc(n) op(1+(n mod 2),[1,2]) ; end proc:
    A187093 := proc(n) (n^2-1+(-1)^floor(n/2)*A000034(n))/2 ;end proc: # R. J. Mathar
  • Mathematica
    LinearRecurrence[{3, -4, 4, -3, 1}, {0, 1, 1, 3, 8}, 60] (* Jean-François Alcover, Mar 30 2020 *)
    Join[{0},RecurrenceTable[{a[1]==a[2]==1,a[n+1]==n^2-a[n-1]},a,{n,60}]] (* Harvey P. Dale, Jan 05 2023 *)
  • PARI
    a(n) = (n^2-1+(-1)^(n\2)*(1 + (n % 2)))/2; \\ Michel Marcus, Sep 11 2016
  • Python
    print(0, end=',')       # a(-1)=0
    prpr = prev = 1         # a(0)=a(1)=1
    for n in range(2, 77):
        print(prpr, end=',')
        curr = n*n - prpr   # a(n) = n^2 - a(n-2)
        prpr = prev
        prev = curr
    # from Alex Ratushnyak, Aug 05 2012
    

Formula

a(n) = (n^2 - 1 + (-1)^floor(n/2) * A000034(n))/2.
G.f.: x*(-1+2*x+x^3-4*x^2) / ( (x^2+1)*(x-1)^3 ).
a(2^(n+1)) = A081654(n). - Anton Zakharov, Sep 13 2016

Extensions

Edited by N. J. A. Sloane, Mar 09 2011
More terms from Alex Ratushnyak, Aug 05 2012