Note: Please adjust width of browser if only one column is visible.

If a fair coin is flipped 100 times and a streak of 7 heads (or tails) in a row is observed, is that an unusual result? To answer this we can simulate tosses of a fair coin and keep track of runs of heads or tails.

This Shiny app allows you to simulate the outcomes of a fair coin flipped
*n*
times. Any runs of at least the length you specify will be marked in color, and the length of the longest run will be given. You may also choose to display the predicted approximate length of the longest run and an approximate 95% prediction interval for the length of the longest run. Details on these two estimators can be found in the first reference below.

More information on the length of the longest run can be found in the following journal articles:

Schilling, M. 'The Longest Run of Heads'
*The College Mathematics Journal*
, 21(3), 196--207

Schilling, M. 'The Surprising Predictability of Long Runs'
*Mathematics Magazine*
, 85(2), 141--149