Spooky Sale: 10% off Premium yearly · $118.80 for the first year · until Nov 6Get it

Deep-ML
Learn
Problems1,200+ hands-on ML problemsLearning PathA guided route through the fundamentalsLabsInteractive labs on real techniquesProjectsBuild a GPT, an RL agent, CUDA kernelsCollectionsCurated problem sets and videosMathPen-and-paper math for MLIntuitionInvent the idea behind the formula yourselfPlaylistsYour own problem lists, shareableStudy AssistantAn AI teacher that knows your progress
Interview Prep
Compete
ContestsFresh problem sets, ranked liveLeaderboardWhere you stand, globallyBuddiesSolve with a friend: streaks, a weekly board, chat
Discuss
Deep-Path
Premium
      Intuition
      45 of 130

      Until the first six

      A board game: your piece can only leave home when you roll a six. Write chance_first_on(roll, p): the chance that your first six comes on roll number roll (1 is the first roll), when each roll succeeds with chance p. The puzzle also plays a quick version with a coin (heads lets you out), a house rule where a five or a six will do, and a long version that needs a 20 on a 20-sided die.

      216 players each roll a die, round after round; a six lets a piece out of home. Each column is a roll number, and the players stack in the column of the roll that got them out. The obvious guess, 1 in 6 on every roll, runs out of players by roll 6. The goal is the shape it ends on. Once it has played, click a column.

      A board game: a piece leaves home only on a six. 216 players start at home.homeat home: 216roll1234567891011121314151617181920
      Your functionchance_first_on(roll, p)
      rollwhich roll it is, 1 for the first roll, 2 for the second, ...e.g. 1
      pthe chance that one roll succeeds, e.g. 1/6 for a six on a diee.g. 0.167
      returnsthe chance that the first success comes on exactly this roll
      solution.pyLoading Python
      Sign in for an AI hint
      ← Calls per minuteThe bus you wait for →