模拟瓢虫时钟谜题
Simulating the Ladybug Clock Puzzle

原始链接: https://austinhenley.com/blog/ladybugclock.html

奥斯汀·亨利被3Blue1Brown提出的一个谜题所吸引:一只瓢虫从时钟的12点开始,随机移动到相邻的刻度,直到访问所有刻度。它最终停在某个特定数字(例如6)上的概率是多少? 起初,亨利猜测6最有可能,因为它的距离较远,但他的直觉被证明是错误的。他构建了一个模拟器来测试他的假设,期望基于与起点的接近程度出现某种模式。然而,经过数千次运行(最终超过10,000次),模拟器揭示了一个令人惊讶的结果:**每个数字(1-11)都有相同的概率1/11作为最终停靠点。** 这个谜题突出了直觉在随机游走问题中很容易被误导。亨利还提出了一个后续问题:瓢虫访问所有12个刻度平均需要多少步?邀请进一步探索。

黑客新闻 新 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 模拟瓢虫时钟谜题 (austinhenley.com) 6 分,由 azhenley 2小时前发布 | 隐藏 | 过去 | 收藏 | 讨论 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请YC | 联系 搜索:
相关文章

原文
Simulating the ladybug clock puzzle - Austin Z. Henley

Associate Teaching Professor
Carnegie Mellon University



1/17/2026

Screenshot of 3Blue1Brown's YouTube video showing 4 clocks with ladybugs moving around.

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


Current Run

Steps 0

Visited 1/12

Run 0/0

Avg Steps -

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 111.

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!

联系我们 contact @ memedata.com