Your friend has given you a very unusual birthday present.

It is a round box, and inside the lid are $n$ buttons equally spaced in a circle.
The box functions like this; you can press two buttons, and then the box will shut by itself and spin the buttons around by one place (you don't know whether it spins them clockwise or anticlockwise, though, and it can go a different way each time), before letting you press another two buttons.
Each time you open the box, it looks identical - there's no feedback on which buttons you've pressed before either, they're springy and they remove fingerprints and markings and they all reset to the same temperature and they yada yada, don't post a non-theoretical answer please :)

Once all buttons have been pressed at least once, it will sing you an amusing rendition of happy birthday that you really want to hear!

For what n do you have a strategy to ensure that the box will eventually sing happy birthday?

  • 4
    $\begingroup$ They're not my friend anymore. $\endgroup$
    – Strawberry
    Commented Jan 17, 2017 at 10:33

2 Answers 2


All of them.

On each attempt, one of your two buttons should be the one closest to your finger. This means that you now have one finger to "move" around, keeping the other held still. Now look at any particular button. It will move around, one position "left" or "right", until it either hits your stationary finger (at which point it is pressed) or hits your moving finger.

Now imagine taking the rest of those positions in a line. This is now equivalent to the Sleeping Beauty Problem, which is solvable by the strategy given in that post.

Since you press any arbitrary button within as many moves as it takes to solve the Sleeping Beauty problem (a finite number), you must press all the buttons.

  • 1
    $\begingroup$ Yay! youtube.com/watch?v=v26G0pX86Po $\endgroup$ Commented Jan 17, 2017 at 6:05
  • 1
    $\begingroup$ Except for 1, because then it would be impossible to press two buttons. I'm a pedant. $\endgroup$
    – boboquack
    Commented Jan 17, 2017 at 7:21
  • 1
    $\begingroup$ @boboquack The OP never said two distinct buttons, right? $\endgroup$
    – Ankoganit
    Commented Jan 17, 2017 at 9:58
  • $\begingroup$ @Ankoganit But then the question would be trivial... $\endgroup$
    – boboquack
    Commented Jan 17, 2017 at 21:03
  • $\begingroup$ Lets say there are $n=4$ buttons in the cardinal positions. If South is your stationary finger, your button presses will be "South, West", "South, North", "South East" from your description of the strategy right? However, if the box rotates counter clockwise the first time, and clockwise the second time, you will fail to press button that was originally in the North position with this strategy. $\endgroup$
    – Trenin
    Commented Jan 18, 2017 at 15:55

Well, this isn't great, but it's something. What if each time you pushed the button you (think) was pushed last time, and then push the next button clockwise?

If the ring spins counter-clockwise then a new button is located in the position of the last button you pushed. You will push the new button and a new button after that, progressing two spaces around the ring.

If the ring spins clockwise you will end up pressing the same two buttons you pressed last time, making no progress around the ring.

Soo... You would push 2n buttons for counter-clockwise spins + 2 buttons times the number of clockwise spins. If this box only actually spins clockwise and your friend was just being a jerk and lied to you about it ever spinning the other way, you will never get to hear the song.

So I guess my answer is between 2n presses and ∞n presses. Not ideal..


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.