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.

A130205 a(n) = n^2 - a(n-1) - a(n-2), with a(1) = 1 and a(2) = 2.

Original entry on oeis.org

1, 2, 6, 8, 11, 17, 21, 26, 34, 40, 47, 57, 65, 74, 86, 96, 107, 121, 133, 146, 162, 176, 191, 209, 225, 242, 262, 280, 299, 321, 341, 362, 386, 408, 431, 457, 481, 506, 534, 560, 587, 617, 645, 674, 706, 736, 767, 801, 833, 866, 902, 936, 971, 1009, 1045, 1082
Offset: 1

Views

Author

Zak Seidov, May 16 2007

Keywords

Comments

Any three consecutive terms sum up to a perfect square. First 9 terms coincide with A076991.
Changing a(1) leaves a(5+3m) constant for m >= 0. Changing a(2) leaves a(4+3m) constant for m >= 0. - Richard R. Forberg, Jun 05 2013

Examples

			1+2+6=3^2, 2+6+8=4^2, 6+8+11=5^2.
G.f. = x + 2*x^2 + 6*x^3 + 8*x^4 + 11*x^5 + 17*x^6 + 21*x^7 + 26*x^8 + ...
		

Crossrefs

Programs

  • Maple
    A130205 := proc(n)
        option remember;
        if n <= 2 then
            n;
        else
            n^2-procname(n-1)-procname(n-2) ;
        end if;
    end proc:
    seq(A130205(n),n=1..50) ; # R. J. Mathar, Aug 06 2016
  • Mathematica
    a[1]=1;a[2]=2;a[n_]:=a[n]=n^2-a[n-1]-a[n-2]; Table[a[n],{n,100}]
    a[ n_] := Quotient[ (n + 1)^2, 3] + 1 - Mod[n, 3]; (* Michael Somos, Aug 04 2016 *)
  • PARI
    a(n)=(n^2+2*n+4)\3 - n%3 \\ Charles R Greathouse IV, Aug 03 2016

Formula

a(1)=1, a(2)=2; n>2: a(n)=n^2-a(n-1)-a(n-2).
G.f.: x*(1+3*x^2-3*x^3+x^4)/(1+x+x^2)/(1-x)^3. - Maksym Voznyy (voznyy(AT)mail.ru), Jul 27 2009; checked and corrected by R. J. Mathar, Sep 16 2009
a(n) = floor((n^2+2*n+1)/3) + 1 - (n mod 3). - Ivan Neretin, May 25 2015
For n>6, a(n)=2*a(n-3)-a(n-6)+6. - Zak Seidov, Aug 05 2016
a(n) = (3*n^2+6*n+1 +8*A049347(n)+7*A049347(n-1))/9.. - R. J. Mathar, Aug 06 2016