2018-01-01 11:05:12 -05:00
2026-03-29 22:42:36 -07:00
2014-08-12 18:36:09 -04:00
2026-03-29 21:12:06 -07:00

Probability Puzzles

A collection of programming solutions and simulations for various probability puzzles, ranging from classic problems to modern brain teasers.

Classical Problems (Frederick Mosteller)

Many of these solutions are based on problems from Fifty Challenging Problems in Probability by Frederick Mosteller.

Dice & Coin Puzzles

Card Puzzles

  • The First Ace (Problem 40) - How many cards are dealt from a shuffled deck before the first ace appears?
  • Average Number of Matches (Problem 43) - What is the average number of matches between two decks of shuffled cards?

Gambling & Betting Strategies

  • Chuck-a-Luck (Problem 19) - What is the player's expected loss per unit stake in Chuck-a-Luck?
  • Craps (Problem 20) - What is the player's chance to win at Craps?
  • Curing the Compulsive Gambler (Problem 21) - Will a player be behind after 36 plays of one number in Roulette?
  • Gambler's Ruin (Problem 24) - What is the probability of a player winning under specific conditions?
  • Bold Play vs. Cautious Play (Problem 25) - Compare the merits of two different gambling strategies.

Geometry & Continuous Probability

  • Lengths of Random Chords (Problem 26) - What is the probability that a random chord on a circle exceeds its radius?
  • The Clumsy Chemist (Problem 28) - What is the average length of pieces from randomly broken glass rods?
  • The Little End of the Stick (Problem 30) - What is the average length of the smaller piece of a randomly broken stick?
  • The Broken Bar (Problem 31) - What are the average sizes of all pieces of a bar randomly broken in three?

Combinatorics & Arrangements

  • Collecting Coupons (Problem 14) - How many coupons must you collect to complete a set?
  • The Theater Row (Problem 15) - How many adjacent "marriageable couples" are expected in a random row of 15?

Logic, Timing & Decisions

  • Successive Wins (Problem 2) - Which series of games offers a better probability of winning two in a row?
  • The Flippant Juror (Problem 3) - Which jury has a better probability of making the correct decision?
  • Catching the Cautious Counterfeiter (Problem 23) - What is the probability of catching a counterfeiter during sampling?
  • The Hurried Duelers (Problem 27) - If duelists arrive at random times, what fraction of duels lead to violence?
  • Will Second-Best Be Runner-Up? (Problem 10) - What is the probability that the second-best player is the runner-up in a tournament?
  • Twin Knights (Problem 11) - What are the odds that twins will meet in a tournament?

Miscellaneous Puzzles

Problems from various sources including FiveThirtyEight, Futility Closet, and Twitter.

Games & Gambling

  • The Petersburg Paradox - What would be a fair price to pay the casino for entering the game?
  • Yahtzee - What is the probability of rolling five of a kind with three rolls?
  • Carnival Barker - What is the expected value of winnings in a specific carnival dice game?
  • Three Flips - Should you pay to play a specific coin-flipping game with tiered payouts?
  • Flipping Four Coins - Evaluating a bet on whether heads and tails both appear twice in four flips.

Dice & Coin Sequences

Arrangements & Seating

  • All Aboard - Whats the probability that the last passenger on an airplane finds his seat occupied?
  • Theater Seats - What is the probability that two friends won't sit together in a cinema?
  • Gummy Bears - What is the probability of selecting five different flavors from a pack?
  • Infinite Monkeys - Probability of specific names appearing if monkeys type letters at random.
  • Minority Selection - Probability that no member of a minority party is selected for N slots.
  • Bags of Marbles - Probability that a second marble drawn is white in a specific game.
  • A Painting Puzzle - What is the expected number of turns for all balls to become the same color?

Data & Bayesian Analysis

Miscellaneous Logic

  • Lunch in the Park - What is the probability that two friends meet for lunch given random arrivals?
  • Missiles - Probability that a target is hit by at least one of four missiles.
  • Quiz Answers - Generating an optimal strategy for a specific quiz game.
  • Draw Two - Expected value of the sum of two integers drawn from 1-10.
  • Exceed 1 - How many random numbers are needed to sum to more than 1?
  • How Long Will You Shuffle This Damn Deck Of Cards - Reversals required in a specific card shuffling problem.
  • Lonely Card Game - Probability of winning a game where you lose on a rank match during deal.
Description
Programming solutions to problems in probability.
Readme 118 KiB
Languages
Python 100%