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.

A050232 a(n) is the number of n-tosses having a run of 4 or more heads for a fair coin (i.e., probability is a(n)/2^n).

Original entry on oeis.org

0, 0, 0, 1, 3, 8, 20, 48, 111, 251, 558, 1224, 2656, 5713, 12199, 25888, 54648, 114832, 240335, 501239, 1042126, 2160676, 4468664, 9221281, 18989899, 39034824, 80103276, 164126496, 335808927, 686182387, 1400438814, 2854992080, 5814293120, 11829648225, 24046855887, 48840756608
Offset: 1

Views

Author

Keywords

Comments

a(n-1) is the number of compositions of n with at least one part >= 5. - Joerg Arndt, Aug 06 2012

References

  • W. Feller, An Introduction to Probability Theory and Its Applications, Vol. 1, 2nd ed. New York: Wiley, p. 300, 1968.

Crossrefs

Column 5 of A109435.

Programs

  • Magma
    R:= PowerSeriesRing(Integers(), 50);
    [0,0,0] cat Coefficients(R!( x^4/((1-2*x)*(1-x-x^2-x^3-x^4)) )); // G. C. Greubel, Jun 01 2025
    
  • Mathematica
    Flatten[With[{tetrnos=LinearRecurrence[{1,1,1,1},{0,1,1,2},50]}, Table[ 2^n- Take[tetrnos,{n+3}],{n,40}]]] (* Harvey P. Dale, Dec 02 2011 *)
    LinearRecurrence[{3,-1,-1,-1,-2}, {0,0,0,1,3}, 31] (* Ray Chandler, Aug 03 2015 *)
  • PARI
    a(n)=([0,1,0,0,0; 0,0,1,0,0; 0,0,0,1,0; 0,0,0,0,1; -2,-1,-1,-1,3]^(n-1)*[0;0;0;1;3])[1,1] \\ Charles R Greathouse IV, Feb 09 2017
    
  • Python
    def a(n, adict={0:0, 1:0, 2:0, 3:1, 4:3}):
        if n in adict:
            return adict[n]
        adict[n]=3*a(n-1) - a(n-2) - a(n-3) - a(n-4) - 2*a(n-5)
        return adict[n] # David Nacin, Mar 07 2012
    
  • SageMath
    def A050232_list(prec):
        P.= PowerSeriesRing(QQ, prec)
        return P( x^4/((1-2*x)*(1-x-x^2-x^3-x^4)) ).list()
    a=A050232_list(41); a[1:] # G. C. Greubel, Jun 01 2025

Formula

a(n) = 2^n - tetranacci(n+4), see A000078. - Vladeta Jovovic, Feb 23 2003
G.f.: x^4/((1-2*x)*(1-x-x^2-x^3-x^4)). - Geoffrey Critzer, Jan 29 2009
a(n) = 3*a(n-1) - a(n-2) - a(n-3) - a(n-4) - 2*a(n-5). - Wesley Ivan Hurt, Apr 23 2021