A short nim game [duplicate]

There are 50 lucifers on the table.

The rules are:

-You must take 1, 2, 3, 4, or 5 lucifers each turn.

-After player 1 has taken some amount of lucifers, it is player 2's turn, and vice versa.

-The player who takes the last lucifer wins!

Puzzle:

Find a strategy that you can almost always win.

Hint: It has to do with the amount of maximum lucifers you can take.

Here is a different game:

If the player picks the last lucifer, he loses!

(this one is a little harder)

If you have to take exactly 5:

Well, the second player wins trivially.

If you can take a number from 1 up to 5 (which is what I'm assuming)

As the first player, always end on a multiple of 6. Start by taking 2 to bring the number to 48. No matter what your opponent does, bring it down to 42, then 36, then 30, then... you get the point. Eventually, you'll get it down to 6. Then your opponent has to leave 1 to 5, and you can take all of the remaining ones and win.

If you can take a number from 0 up to 5

The game will be deadlocked at 48, with neither player opting to take any because then the other player will bring it down to the next multiple of 6.

For the alternate game (which actually isn't too much harder)

Just leave the number remaining as 1 more than a multiple of 6 as opposed to just a multiple of 6. When it gets down to 7, after your opponent goes, bring it down to 1, forcing your opponent to take the last one.

• For the last bit rot13(gurer vf ab unez ng nyy va gnxvat sebz sbegl rvtug, gur erny qrnqybpx vf ng fvk). Yes this is a moot point, the OP was edited while I wrote this, but I am not going to let that spoil my nitpick :-) – deep thought Jan 22 '19 at 18:21