LmCast :: Stay tuned in

Simulating the Ladybug Clock Puzzle

Recorded: Jan. 19, 2026, 10:03 a.m.

Original Summarized

Simulating the ladybug clock puzzle - Austin Z. Henley

Austin Z. Henley

Associate Teaching Professor
Carnegie Mellon University

azhenley@cmu.edu
@austinzhenley
github/AZHenley

Home |
Publications |
Teaching |
Blog

Simulating the ladybug clock puzzle
1/17/2026

A few days ago, 3Blue1Brown posted a 60-second video describing a puzzle...
Imagine that a ladybug lands on the 12 o'clock marker of a clock. It then proceeds to move either clockwise or counterclockwise to the adjacent hour marker, one at a time, and repeats until all hour markers have been visited at least once.
What is the probability that it ends on the 6?
These sort of puzzles always intrigue me. They're simple to describe and at first might even look easy to solve, but as I dig into them, my intuition leads me astray.
What a fun Saturday morning project! I whipped up a simulator to try it out. It works like this:

let position = 0; // 0-11 hour markers
let visited = new Set([0]);

while (visited.size < 12) {
const direction = Math.random() < 0.5 ? -1 : 1;
position = (position + direction + 12) % 12;
visited.add(position);
}

return position;

See, it is simple. But before running the simulator, can you guess the probability of it ending on 6? What about 11 or 1? 3? The other numbers?
The simulator

Speed

5 ticks/sec

Total Runs

Start
Stop
Reset

Current Run

Steps
0

Visited
1/12

Run
0/0

Avg Steps
-

Ending Position

Spoiler: Tell me the answer!
It stumped me. My guess was that 6 would be the most likely—it is the farthest away but it is also necessary to visit all other numbers first. The numbers closer to 12 would be gradually less likely. Am I right? It might remind you of other random walk problems.
So what is the answer? Well, I first ran the simulator 100 times and the results looked random. More runs! After ~1500 runs, all of the numbers were showing 8-10% likelihood with no discernable pattern. That isn't what I expected. After 5000 runs, they were all 8.4-9.7%. And then after 10,000 runs...
Based on the simulator, all numbers are equally likely with 9% probability, excluding 12 of course, since that is visited first and thus can't be last. The answer is 1⁄11.
An even more fun question? What is the average number of moves that the ladybug will make to visit all 12 numbers? I'd love to hear someone's explanation for that answer!

Austin Z. Henley presents a simulation-based exploration of a probabilistic puzzle involving a ladybug navigating a clock face. The problem centers on determining the likelihood that a ladybug, starting at the 12 o’clock position and moving randomly either clockwise or counterclockwise to adjacent hour markers, will end its journey on the 6 o’clock position after visiting all 12 hour markers at least once. Henley frames the puzzle as a classic example of a random walk, where initial intuition about probabilities may mislead due to the complexity of path dependencies. The ladybug’s movement is governed by a simple algorithm: at each step, it randomly chooses a direction (with equal probability), updates its position modulo 12 to ensure it remains on the clock face, and marks each visited hour. The process continues until all hours are covered, at which point the final position is recorded. Henley’s goal is to test whether certain positions—particularly 6, which is diametrically opposite the starting point—are more likely to be the terminal location than others.

Henley’s initial hypothesis reflects common assumptions about such problems: he expects 6 to be the most probable endpoint, reasoning that its distance from the starting point might create a higher likelihood of being the last visited. However, his simulation, implemented in JavaScript, reveals a counterintuitive result. After running the algorithm thousands of times (100, 1,500, 5,000, and 10,000 iterations), the distribution of final positions stabilizes to approximately 8.4–9.7% for each hour marker except 12, which is excluded because it is the starting point and thus cannot be the last. This outcome suggests that all non-starting positions are equally probable, yielding a probability of 1/11 (approximately 9.09%) for each. Henley emphasizes that this result defies expectations, as the symmetry of the clock and the random nature of the walk erase any bias toward positions based on their geometric relationship to the starting point. The simulation’s code, which uses a set to track visited hours and updates the ladybug’s position through modular arithmetic, underscores the problem’s reliance on probabilistic uniformity rather than spatial intuition.

The article also raises a secondary question: what is the average number of steps required for the ladybug to visit all 12 hour markers? While Henley does not provide a mathematical derivation for this value, he invites further analysis, highlighting the puzzle’s broader implications for understanding random walks and coverage problems. The simulation’s results underscore a key principle in probability theory: even in scenarios with seemingly deterministic constraints (e.g., visiting all nodes on a graph), random processes can lead to uniform distributions when the underlying structure lacks inherent asymmetries. Henley’s work serves as both an empirical investigation and a pedagogical tool, demonstrating how computational simulations can challenge and refine probabilistic reasoning. By documenting his process—from initial assumptions to iterative testing—Henley illustrates the value of computational experimentation in uncovering hidden patterns and validating or refuting theoretical predictions. The puzzle, while deceptively simple, thus becomes a case study in the interplay between intuition, computation, and mathematical rigor.