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.

Showing 1-2 of 2 results.

A247594 a(n) = a(n-1) + a(n-2) + 3*a(n-3) with a(0) = 1, a(1) = 2, a(2) = 5.

Original entry on oeis.org

1, 2, 5, 10, 21, 46, 97, 206, 441, 938, 1997, 4258, 9069, 19318, 41161, 87686, 186801, 397970, 847829, 1806202, 3847941, 8197630, 17464177, 37205630, 79262697, 168860858, 359740445, 766389394, 1632712413, 3478323142, 7410203737, 15786664118, 33631837281
Offset: 0

Views

Author

Michael Somos, Sep 20 2014

Keywords

Comments

a(n) is the number of words of length n in {A,B,C} such that no two consecutive letters are B and every letter C is adjacent to exactly one letter B.

Examples

			G.f. = 1 + 2*x + 5*x^2 + 10*x^3 + 21*x^4 + 46*x^5 + 97*x^6 + 206*x^7 + ...
a(3) = 10 with words [AAA, AAB, ABA, ABC, ACB, BAA, BAB, BCA, CBA, CBC].
		

Crossrefs

Programs

  • Haskell
    a247594 n = a247594_list !! n
    a247594_list = 1 : 2 : 5 : zipWith (+)
       (tail $ zipWith (+) a247594_list $ tail a247594_list)
       (map (* 3) a247594_list)
    -- Reinhard Zumkeller, Sep 21 2014
    
  • Magma
    I:=[1,2,5]; [n le 3 select I[n] else Self(n-1)+Self(n-2)+3*Self(n-3): n in [1..40]]; // Vincenzo Librandi, Aug 13 2015
  • Mathematica
    LinearRecurrence[{1, 1, 3}, {1, 2, 5}, 40] (* Vincenzo Librandi, Aug 13 2015 *)
  • PARI
    {a(n) = if( n<0, polcoeff( (2*x + x^2 + x^3) / (3 + x + x^2 - x^3) + x * O(x^-n), -n), polcoeff( (1 + x + 2*x^2) / (1 - x - x^2 - 3*x^3) + x * O(x^n), n))};
    
  • PARI
    first(m)={my(v=vector(m));v[1]=1;v[2]=2;v[3]=5;for(i=4,m,v[i]=v[i-1]+v[i-2]+3*v[i-3]);v;} /* Anders Hellström, Aug 12 2015 */
    

Formula

G.f.: (1 + x + 2*x^2) / (1 - x - x^2 - 3*x^3).
0 = a(n) - a(n-1) - a(n-2) - 3*a(n-3) for all n in Z.
From Greg Dresden, Aug 05 2022: (Start)
a(n) = b(n+3) - b(n) for b(n) = A103143(n).
a(n) = c(n+2) - 2*c(n-1) for c(n) = A123102(n). (End)

A356411 Sum of powers of roots of x^3 - x^2 - x - 3.

Original entry on oeis.org

3, 1, 3, 13, 19, 41, 99, 197, 419, 913, 1923, 4093, 8755, 18617, 39651, 84533, 180035, 383521, 817155, 1740781, 3708499, 7900745, 16831587, 35857829, 76391651, 162744241, 346709379, 738628573, 1573570675, 3352327385, 7141783779
Offset: 0

Views

Author

Greg Dresden, Aug 05 2022

Keywords

Comments

a(n) is the sum of the n-th powers of the three roots of x^3 - x^2 - x - 3. These roots are c1 = 2.130395..., c2 = -0.5651977... - i*1.0434274..., and c3 = -0.5651977... + i*1.0434274..., and so a(n) = c1^n + c2^n + c3^n. The real parts of c2 and c3 are A273065.
a(n) can also be determined by Vieta's formulas and Newton's identities. For example, a(3) by definition is c1^3 + c2^3 + c3^3, and from Newton's identities this equals e1^3 - 3*e1*e2 + 3*e3 for e1, e2, e3 the elementary symmetric polynomials of x^3 - x^2 - x - 3. From Vieta's formulas we have e1 = 1, e2 = -1, and e3 = 3, giving us e1^3 - 3*e1*e2 + 3*e3 = 1 + 3 + 9 = 13, as expected.

Examples

			For n=3, a(3) = (2.130395...)^3 + (-0.5651977... - i*1.0434274...)^3 + (-0.5651977... + i*1.0434274...)^3 = 13.
		

Crossrefs

Cf. A103143, A123102, A247594, A356463, A273065 (Re c2,c3).

Programs

  • Mathematica
    LinearRecurrence[{1, 1, 3}, {3, 1, 3}, 40]
  • PARI
    polsym(x^3 - x^2 - x - 3, 35) \\ Joerg Arndt, Aug 11 2022

Formula

a(n) = a(n-1) + a(n-2) + 3*a(n-3) with a(0)=3, a(1)=1, a(2) = 3.
G.f.: (3 - 2*x - x^2)/(1 - x - x^2 - 3*x^3).
Showing 1-2 of 2 results.