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.

A122021 a(n) = a(n-2) - (n-1)*a(n-3), with a(0) = 0, a(1) = 1, a(2) = 2.

Original entry on oeis.org

0, 1, 2, 1, -1, -7, -6, -1, 43, 47, 52, -383, -465, -1007, 4514, 5503, 19619, -66721, -73932, -419863, 1193767, 1058777, 10010890, -25204097, -14340981, -265465457, 615761444, 107400049, 7783328783, -17133920383, 4668727362
Offset: 0

Views

Author

Roger L. Bagula, Sep 12 2006

Keywords

Crossrefs

Programs

  • GAP
    a:= function(n)
        if n<3 then return n;
        else return a(n-2) - (n-1)*a(n-3);
        fi;
      end;
    List([0..30], n-> a(n) ); # G. C. Greubel, Oct 06 2019
  • Magma
    I:=[0,1,2]; [n le 3 select I[n] else Self(n-2) - (n-2)*Self(n-3): n in [1..30]]; // G. C. Greubel, Oct 06 2019
    
  • Maple
    a:= proc(n) option remember;
    if n < 3 then n
    else a(n-2)-(n-1)*a(n-3)
    fi;
    end proc;
    seq(a(n), n = 0..30); # G. C. Greubel, Oct 06 2019
  • Mathematica
    a[0]=0; a[1]=1; a[2]=2; a[n_]:= a[n]= a[n-2] - (n-1)*a[n-3]; Table[a[n], {n, 0, 30}]
    RecurrenceTable[{a[0]==0,a[1]==1,a[2]==2,a[n]==a[n-2]-(n-1)a[n-3]},a,{n,30}] (* Harvey P. Dale, Apr 29 2022 *)
  • PARI
    my(m=30, v=concat([0,1,2], vector(m-3))); for(n=4, m, v[n] = v[n-2] - (n-2)*v[n-3]); v \\ G. C. Greubel, Oct 06 2019
    
  • Sage
    def a(n):
        if (n<3): return n
        else: return a(n-2) - (n-1)* a(n-3)
    [a(n) for n in (0..30)] # G. C. Greubel, Oct 06 2019
    

Extensions

Edited by N. J. A. Sloane, Sep 12 2006
Offset changed by G. C. Greubel, Oct 06 2019