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.

A142881 a(0) = 0, a(1) = 1, after which, if n=3k: a(n) = 2*a(n-1) - a(n-2), if n=3k+1: a(n) = a(n-1) + a(n-2), if n=3k+2: a(n) = 2*a(n-1) + a(n-2).

Original entry on oeis.org

0, 1, 2, 3, 5, 13, 21, 34, 89, 144, 233, 610, 987, 1597, 4181, 6765, 10946, 28657, 46368, 75025, 196418, 317811, 514229, 1346269, 2178309, 3524578, 9227465, 14930352, 24157817, 63245986, 102334155, 165580141, 433494437, 701408733, 1134903170
Offset: 0

Views

Author

Roger L. Bagula and Gary W. Adamson, Sep 28 2008

Keywords

Comments

The original name of the sequence was: A modulo three switched recursion (third kind): a(n)=If[Mod[n, 3] ==2, 2*a(n - 1) + a(n - 2), If[Mod[n, 3] == 1, a(n - 1) + a(n - 2), 2*a(n - 1) - a(n - 2)]].
How is this related to A000045 ? - Antti Karttunen, Jan 29 2016

Crossrefs

Programs

  • Mathematica
    Clear[a, n]; a[0] = 0; a[1] = 1; a[n_] := a[n] = If[Mod[n, 3] == 2, 2*a[n - 1] + a[n - 2], If[Mod[n, 3] == 1, a[n - 1] + a[n - 2], 2*a[n - 1] - a[n - 2]]]; b = Table[a[n], {n, 0, 50}]
  • PARI
    a=vector(100); a[1]=1; a[2]=2; for(n=3, #a, if(n%3==0, a[n]=2*a[n-1]-a[n-2], if(n%3==1, a[n]=a[n-1]+a[n-2], a[n]=2*a[n-1]+a[n-2]))); concat(0, a) \\ Colin Barker, Jan 30 2016

Formula

a(n) = If[Mod[n, 3] == 2, 2*a(n - 1) + a(n - 2), If[Mod[n, 3] == 1, a(n - 1) + a(n - 2), 2*a(n - 1) - a(n - 2)]].
a(n) = 7*a(n-3)-a(n-6). G.f.: -x^2*(x^4+2*x^3-3*x^2-2*x-1) / (x^6-7*x^3+1). [Colin Barker, Jan 08 2013]
a(0) = 0, a(1) = 1, after which, if n is a multiple of 3, a(n) = 2*a(n-1) - a(n-2), else, if n is of the form 3k+1, a(n) = a(n-1) + a(n-2), and otherwise [when n is of the form 3k+2], a(n) = 2*a(n-1) + a(n-2). - Antti Karttunen, Jan 29 2016, after the original name of the sequence.

Extensions

Offset corrected and sequence edited by Antti Karttunen, Jan 29 2016