# Penney's game

**Penney's game**, named after its inventor Walter Penney, is a binary (head/tail) sequence generating game between two players. Player A selects a sequence of heads and tails (of length 3 or larger), and shows this sequence to player B. Player B then selects another sequence of heads and tails of the same length. Subsequently, a fair coin is tossed until either player A's or player B's sequence appears as a consecutive subsequence of the coin toss outcomes. The player whose sequence appears first wins.

Provided sequences of at least length three are used, the second player (B) has an edge over the starting player (A). This is because the game is nontransitive such that for any given sequence of length three or longer one can find another sequence that has higher probability of occurring first.

For the three-bit sequence game, the second player can optimize their odds by choosing sequences according to:

An easy way to remember the sequence is for the second player to start with the opposite of the middle choice of the first player, then follow it with the first player's first two choices.

where (not-2) is the opposite of the second choice of the first player.

An intuitive explanation for this result is that in any case that the sequence is not immediately the first player's choice, the chances for the first player getting their sequence-beginning, the opening two choices, are usually the chance that the second player will be getting their full sequence. So the second player will most likely "finish before" the first player.

One suggested variation on Penney's Game uses a pack of ordinary playing cards. The Humble-Nishiyama Randomness Game follows the same format using Red and Black cards, instead of Heads and Tails.^{[1]}^{[2]} The game is played as follows. At the start of a game each player decides on their three colour sequence for the whole game. The cards are then turned over one at a time and placed in a line, until one of the chosen triples appears. The winning player takes the upturned cards, having won that "trick". The game continues with the rest of the unused cards, with players collecting tricks as their triples come up, until all the cards in the pack have been used. The winner of the game is the player that has won the most tricks. An average game will consist of around 7 "tricks". As this card-based version is quite similar to multiple repetitions of the original coin game, the second player's advantage is greatly amplified. The probabilities are slightly different because the odds for each flip of a coin are independent while the odds of drawing a red or black card each time is dependent on previous draws. Note that HHT is a 2:1 favorite over HTH and HTT but the odds are different for BBR over BRB and BRR.

Below are approximate probabilities of the outcomes for each strategy based on computer simulations:^{[3]}

If the game is ended after the first trick, there is a negligible chance of a draw. The odds of the second player winning in such a game appear in the table below.

Recently Robert W. Vallin, and later Vallin and Aaron M. Montgomery, presented results with Penney's Game as it applies to (American) roulette with Players choosing Red/Black rather than Heads/Tails. In this situation the probability of the ball landing on red or black is 9/19 and the remaining 1/19 is the chance the ball lands on green for the numbers 0 and 00. There are various ways to interpret green: (1) as a "wild card" so that BGR can be read at Black, Black, Red and Black, Red, Red, (2) as a do-over, the game stops when green appears and restarts with the next spin, (3) as just itself with not extra interpretation. Results have been worked out for odds and wait times.^{[4]}