Game of NIM

Two people play a game of NIM. There are 100 matches on a table, and the players take turns picking 1 to 5 sticks at a time. The person who takes the last stick wins the game. Who has a winning strategy?

The first person has a winning strategy. First, he takes 4 sticks. Then every time the second player takes X sticks, the first player takes 6 – X sticks.

+ latest posts

We do not know where this puzzle originated from. If you have any information, please let us know via email.


Your email address will not be published. Required fields are marked *

    1. Hello, Planes. The last turn can consist of taking any number of sticks between 1 and 5. Whoever plays last and leaves no sticks on the table, wins.

  1. the first player takes 6 – X sticks?
    Why is it.
    Can i get an explanation, because i didnt understand.

    1. Hi Uttej! The idea is that if the person takes 4 sticks first, then there are 96 sticks remaining, which is divisible by 6. Now, if the first person keeps taking 6 – X sticks every time the second person takes X sticks, then the number of sticks will keep decreasing by 6. Therefore, you will get 100 -> 96 -> (96 – X) -> 90 -> (90 -X) -> 84 -> … -> 6 -> (6 – X) -> 0.