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.

A062113 a(0)=1; a(1)=2; a(n) = a(n-1) + a(n-2)*(3 - (-1)^n)/2.

Original entry on oeis.org

1, 2, 3, 7, 10, 24, 34, 82, 116, 280, 396, 956, 1352, 3264, 4616, 11144, 15760, 38048, 53808, 129904, 183712, 443520, 627232, 1514272, 2141504, 5170048, 7311552, 17651648, 24963200, 60266496, 85229696, 205762688, 290992384, 702517760
Offset: 0

Views

Author

Olivier Gérard, Jun 05 2001

Keywords

Comments

A bistable recurrence.

Crossrefs

Programs

  • Haskell
    a062113 n = a062113_list !! n
    a062113_list = 1 : 2 : zipWith (+)
       (tail a062113_list) (zipWith (*) a000034_list a062113_list)
    -- Reinhard Zumkeller, Jan 21 2012
    
  • Magma
    I:=[1,2,3,7]; [n le 4 select I[n] else 4*Self(n-2) - 2*Self(n-4): n in [1..40]]; // G. C. Greubel, Oct 16 2018
  • Mathematica
    LinearRecurrence[{0,4,0,-2}, {1,2,3,7}, 40] (* G. C. Greubel, Oct 16 2018 *)
  • PARI
    { for (n=0, 200, if (n>1, a=a1 + a2*(3 - (-1)^n)/2; a2=a1; a1=a, if (n==0, a=a2=1, a=a1=2)); write("b062113.txt", n, " ", a) ) } \\ Harry J. Smith, Aug 01 2009
    
  • PARI
    x='x+O('x^40); Vec((1+2*x-x^2-x^3)/(1-4*x^2+2*x^4)) \\ G. C. Greubel, Oct 16 2018
    

Formula

a(n) = a(n-1) + a(n-2) * A000034(n). - Reinhard Zumkeller, Jan 21 2012
From Colin Barker, Apr 20 2012: (Start)
a(n) = 4*a(n-2) - 2*a(n-4).
G.f.: (1+2*x-x^2-x^3)/(1-4*x^2+2*x^4). (End)