Acertijos de Mileto42 a riddle every day · the solution, the next day Versión en español

2026-10-25 · Logic / Math

The Last Candy

Ana and Berto have a pile of 47 candies on the table and take turns, with Ana going first. On each turn, the player must eat between 1 and 4 candies (inclusive), as they choose. Whoever eats the last candy in the pile wins.

Both play perfectly and know everything explained here. How many candies must Ana eat on her first turn to be guaranteed victory, however Berto plays? And is there any other opening move that guarantees her the win?

See solution

Ana must eat exactly 2 candies on her first turn, and it is the only winning move.

After eating 2, 45 remain, a multiple of 5. From then on, whenever Berto eats k candies (from 1 to 4), Ana eats 5 − k (also from 1 to 4), so each round removes exactly 5 and the pile stays a multiple of 5. After 9 rounds the pile reaches 0, and Ana eats the last candy.

Any other opening (1, 3 or 4) leaves 46, 45 minus nothing... that is, 46, 44 or 43 candies, none of which is a multiple of 5. Berto can then eat 1, 4 or 3 respectively to leave a multiple of 5 (45, 40 or 40) and apply the same complement-to-5 strategy to win himself. So only eating 2 secures the victory for Ana.