TOPICS
Search

Run


A run is a sequence of more than one consecutive identical outcomes, also known as a clump.

Let R_p(r,n) be the probability that a run of r or more consecutive heads appears in n independent tosses of a coin (i.e., n Bernoulli trials). This is equivalent to repeated picking from an urn containing two distinguishable objects with replacement after each pick. Let the probability of obtaining a head be 0<p<1. Then there is a beautiful formula for R_p(r,n) given in terms of the coefficients of the generating function

 F_p(r,s)=(p^rs^r(1-ps))/(1-s+(1-p)p^rs^(r+1))=sum_(i=r)^inftyc_i^ps^i
(1)

(Feller 1968, p. 300). Then

 R_p(r,n)=sum_(i=r)^nc_i^p.
(2)

The following table gives the triangle of numbers 2^nR_(1/2)(r,n) for n=1, 2, ... and r=1, 2, ..., n (OEIS A050227).

SloaneA000225A008466A050231A050233
n\r12345678
110000000
231000000
373100000
4158310000
53119831000
663432083100
71279447208310
82552011074820831

The special case r=2 gives the sequence

 R_(1/2)(2,n)=2^(n+1)-F_(n+3),
(3)

where F_n is a Fibonacci number. Similarly, the probability that no k consecutive tails will occur in n tosses is given by F_(n+2)^((k))/2^n, where F_l^((k)) is a Fibonacci k-step number.

Feller (1968, pp. 278-279) proved that for w(n)=1-R_(1/2)(3,n),

 lim_(n->infty)w(n)alpha^(n+1)=beta,
(4)

where

alpha=(x^3+2x^2+4x-8)_1
(5)
=1.087378025...
(6)

(OEIS A086253) is the positive root of the above polynomial and

beta=(2-alpha)/(4-3alpha)
(7)
=(11x^3-22x^2+12x-2)_1
(8)
=1.236839844...
(9)

(OEIS A086254) is the positive root of the above polynomial. The corresponding constants for a run of k>1 heads are alpha_k, the smallest positive root of

 1-x+(1/2x)^(k+1)=0,
(10)

and

 beta_k=(2-alpha)/(k+1-kalpha_k).
(11)

These are modified for unfair coins with P(H)=p and P(T)=q=1-p to alpha_k^', the smallest positive root of

 1-x+qp^kx^(k+1)=0,
(12)

and

 beta_k^'=(1-palpha_k^')/((k+1-kalpha_k^')p)
(13)

(Feller 1968, pp. 322-325).

Given n Bernoulli trials with a probability of success (heads) p, the expected number of tails is n(1-p), so the expected number of tail runs >=1 is  approx n(1-p)p. Continuing,

 N_R=n(1-p)p^R
(14)

is the expected number of runs >=R. The longest expected run is therefore given by

 R=log_(1/p)[n(1-p)]
(15)

(Gordon et al. 1986, Schilling 1990). Given m 0s and n 1s, the number of possible arrangements with u runs is

 f_u={2(m-1; k-1)(n-1; k-1)   u=2k; (m-1; k)(n-1; k-1)+(m-1; k-1)(n-1; k)   u=2k+1
(16)

for k an integer, where (n; k) is a binomial coefficient (Johnson and Kotz 1968, p. 268). Then

 P(u<=u^')=sum_(u=2)^(u^')(f_u)/((m+n; m)).
(17)

Now instead consider picking of N objects without replacement from a collection of N containing m indistinguishable objects of one type and k indistinguishable objects of another. Let N(r;m,k) denote the number of permutations of these objects in which no r-run occurs. For example, there are 6 permutations of two objects of type A and two of type B. Of these, AABB, ABBA, BAAB, and BBAA contain runs of length two, so N(2;2,2)=2. In general, the probability that an r-run does occur is given by

 P(r;m,k)=1-(N(r;m,k))/((m+k; k)),
(18)

where (a; b) is a binomial coefficient. Bloom (1996) gives the following recurrence sequence for N(r;m,k),

 N(r;m,k)=e(r;m,k)+sum_(i=0)^(r-1)N(r;m-1,k-i)-sum_(i=1)^(r-1)N(r;m-r,k-i),
(19)

where N(r,m,k)=0 for m or k negative and

 e(r;m,k)={1   if m=0 and 0<=k<r; -1   if m=r and 0<=k<r; 0   otherwise.
(20)

Another recurrence which has only a fixed number of terms is given by

 N(r;m,k)=N(r;m-1,k)+N(r;m,k-1)-N(r;m-r,k-1)-N(r;m-1,k-r)+N(r;m-r,k-r)+e_r^*(m,k),
(21)

where

 e_r^*(m,k)={1   if (m,k)=(0,0) or (r,r); -1   if (m,k)=(0,r) or (r,0); 0   otherwise
(22)

(Goulden and Jackson 1983, Bloom 1996).

These formulas can be used to calculate the probability of obtaining a run of n cards of the same color in a deck of 52 cards. For N=1, 2, ..., this yields the sequence 1, 247959266474051/247959266474052, ... (OEIS A086439 and A086440). Normalizing by multiplying by (52; 26) gives 495918532948104, 495918532948102, 495891608417946, 483007233529142, ... (OEIS A086438). The result

 P(6;26,26)=(2740784175881)/(5903792058906)=0.46424...
(23)

disproves the assertion of Gardner (1982) that "there will almost always be a clump of six or seven cards of the same color" in a normal deck of cards.

Bloom (1996) gives the expected number of noncontiguous r-runs (i.e., split the sequence into maximal clumps of the same value and count the number of such clumps of length >=r) in a sequence of m 0s and n 1s as

 E(n,m,r)=((m+1)(n)_r+(n+1)(m)_r)/((m+n)_r),
(24)

where (a)_n is the falling factorial. For m>10, u has an approximately normal distribution with mean and variance

mu_u=1+(2mn)/(m+n)
(25)
sigma_u^2=(2mn(2mn-m-n))/((m+n)^2(m+n-1)).
(26)

See also

Cards, Coin Tossing, Eulerian Number, Hypergeometric Distribution, Permutation, Permutation Run, s-Run

Explore with Wolfram|Alpha

References

Bloom, D. M. "Probabilities of Clumps in a Binary Sequence (and How to Evaluate Them Without Knowing a Lot)." Math. Mag. 69, 366-372, 1996.Feller, W. An Introduction to Probability Theory and Its Application, Vol. 1, 3rd ed. New York: Wiley, 1968.Finch, S. R. "Feller's Coin Tossing Constants." §5.11 in Mathematical Constants. Cambridge, England: Cambridge University Press, pp. 339-342, 2003.Gardner, M. Aha! Gotcha: Paradoxes to Puzzle and Delight. New York: W. H. Freeman, p. 124, 1982.Godbole, A. P. "On Hypergeometric and Related Distributions of Order k." Commun. Stat.: Th. and Meth. 19, 1291-1301, 1990.Godbole, A. P. and Papastavridis, G. (Eds.). Runs and Patterns in Probability: Selected Papers. New York: Kluwer, 1994.Gordon, L.; Schilling, M. F.; and Waterman, M. S. "An Extreme Value Theory for Long Head Runs." Prob. Th. and Related Fields 72, 279-287, 1986.Goulden, I. P. and Jackson, D. M. Combinatorial Enumeration. New York: Wiley, 1983.Johnson, N. and Kotz, S. Discrete Distributions. New York: Wiley, 1968.Mood, A. M. "The Distribution Theory of Runs." Ann. Math. Statistics 11, 367-392, 1940.Philippou, A. N. and Makri, F. S. "Successes, Runs, and Longest Runs." Stat. Prob. Let. 4, 211-215, 1986.Schilling, M. F. "The Longest Run of Heads." Coll. Math. J. 21, 196-207, 1990.Schuster, E. F. In Runs and Patterns in Probability: Selected Papers (Ed. A. P. Godbole and S. Papastavridis). Boston, MA: Kluwer, pp. 91-111, 1994.Sloane, N. J. A. Sequences A000225/M2655, A008466, A050227, A050231, A050232, A050233, A086253, A086254, A086438, A086439, and A086440 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Run

Cite this as:

Weisstein, Eric W. "Run." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/Run.html

Subject classifications