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.

A280222 a(n) = (-3)^(n-1)*a(n-1) + a(n-2).

Original entry on oeis.org

0, 1, -3, -26, 699, 56593, -13751400, -10024714007, 21924035781909, 143843588740390942, -2831273335253079129477, -167183859029515480776096431, 29616119072670305537790075332880, 15739219935931795986279179944204983649, -25093400345884972653159910700646932070891747
Offset: 0

Views

Author

Seiichi Manyama, Dec 29 2016

Keywords

Examples

			G.f. = x - 3*x^2 - 26*x^3 + 699*x^4 + 56593*x^5 - 13751400*x^6 + ...
		

Crossrefs

Cf. similar sequences with the recurrence q^(n-1)*a(n-1) + a(n-2) for n>1, a(0)=0 and a(1)=1: this sequence (q=-3), A280221 (q=-2), A280261 (q=-1), A000045 (q=1), A015473 (q=2), A015474 (q=3), A015475 (q=4), A015476 (q=5), A015477 (q=6), A015479 (q=7), A015480 (q=8), A015481 (q=9), A015482 (q=10), A015484 (q=11).

Programs

  • GAP
    a:=[1,-3];; for n in [3..15] do a[n]:=(-3)^(n-1)*a[n-1]+a[n-2]; od; Concatenation([0],a); # Muniru A Asiru, Oct 19 2018
  • Magma
    I:=[1,-3]; [0] cat [n le 2 select I[n] else (-3)^(n-1)*Self(n-1) +Self(n-2): n in [1..20]]; // G. C. Greubel, Oct 13 2018
    
  • Mathematica
    a[n_] := (-3)^(n -1) a[n -1] + a[n -2]; a[0] = 0; a[1] = 1; Array[a, 15, 0] (* Robert G. Wilson v, Dec 29 2016 *)
    nxt[{n_,a_,b_}]:={n+1,b,b*(-3)^n+a}; NestList[nxt,{1,0,1},20][[All,2]] (* Harvey P. Dale, Jul 09 2018 *)
  • PARI
    m=20; v=concat([1, -3], vector(m-2)); for(n=3, m, v[n] = (-3)^(n-1)*v[n-1] + v[n-2]); concat([0],v) \\ G. C. Greubel, Oct 13 2018
    
  • Ruby
    def A(m, n)
      i, a, b = 0, 0, 1
      ary = [0]
      while i < n
        i += 1
        a, b = b, b * m ** i + a
        ary << a
      end
      ary
    end
    def A280222(n)
      A(-3, n)
    end