+ Your prediction ({positionToNumber(userPrediction)}):{' '}
+ {((lastPaintedCounts[userPrediction] || 0) / totalSimulations * 100).toFixed(2)}%
+ {' '}— Theory predicts all numbers have equal probability of{' '}
+ {theoreticalProbability.toFixed(2)}%!
+
+
+ )}
+
+
+
+ The Surprising Result: Despite {numPositions === 12 ? '6' : Math.floor(numPositions / 2)} being the farthest from the start,
+ every number (1-{numPositions - 1}) has an equal probability of being painted last: exactly 1/{numPositions - 1} ≈ {theoreticalProbability.toFixed(2)}%!
+
+
+
+ )}
+
+ {/* Educational Info */}
+
+
+
+
+ About This Puzzle
+
+
+
+
+
The Rules
+
+
A ladybug starts at the 12 o'clock position
+
Each second, it randomly moves one step clockwise or counterclockwise (50/50 chance)
+
When the ladybug visits a number, that number gets "painted"
+
The simulation ends when all numbers have been visited at least once
+
+
+
The Surprising Result
+
+ Intuitively, you might expect the number 6 (opposite to 12) to be the most likely to be painted last,
+ since it's the farthest from the starting point. However, the probability is exactly 1/{numPositions - 1} for
+ every number from 1 to {numPositions - 1}! This is because once all but one number is painted, the random walk
+ will eventually reach that last number, regardless of where it is.
+
+
+
Mathematical Connections
+
+
Random Walks on Cycles: This is an example of a random walk on a cycle graph
+
Cover Time: The number of moves to visit all vertices is called the "cover time"
+
Gambler's Ruin: Related to the classic probability problem of a gambler with a finite amount