A Third Cousin of Nim

A slight modification of an earlier puzzle: From a pile of checkers, each player removes one, two or three checkers but is forbidden to take the same number of checkers removed by the previous opponent. The player who takes the last checker or is prevented from playing loses. There are originally 30 checkers in the pile. What is the best strategy to assure you won't lose in a 2-player game? In a 3-player game? What if there are N checkers to begin?

Source: Original. Based on Nim puzzles from four and two years ago.


Solutions were received from Claudio Baiocchi, Ross Millikan, Philippe Fondanaiche, John Hewson, and Dan Ghinea. Dan's solutions follow:
  1. Winning strategy for 2 players:
    
      The player who is about to make a move in a configuration with 
    4k+1 checkers doesn't have a winning stratetgy. So the solution has to
    start by bringing the initial configuraion to a 4k+1 number ( from 30 
    to 29 checkers by removing one checker).
    
      Then at every move try to return the pile to a 4k+1 number by removing
    a multiple of 4. The numbers of checkers that have to be removed depends 
    on then number of checkers removed by the opponent.
    (Let's denote by A(x) the opponent's move and by P(x) the player's move.)
    
    A(1)  =>  P(3) ( total 4 )
    
    A(3)  =>  P(1) ( total 4 )
    
                     /  A(2)  =>  P(3) ( total 8 )
    A(2)  =>  P(1) <
                     \  A(3)  =>  P(2) ( total 8 )
    
    
      This always leads to a configuration with the opponent making the move
    and the number of checkers left being either 1 ( victory ) or 5.
    For 5 checkers left we can apply the following strategy:
    
    A(1)  =>  P(3)  =>  A(1)                  ( victory )
    A(2)  =>  P(1)  =>  A(2)                  ( victory )
    A(3)  =>  P(1)  =>  opponent can't remove ( victory )
    
      The player who starts the game has a winning strategy for every N <> 4k+1.
    If N = 4k+1, then the second player has a winning strategy.  
  2. Winning strategy for 3 players:
    
      The solution starts by observing that there can always be 6 checkers removed 
    in a "round" (3 consecutive moves), not depending on the opponents' (A and B)
    moves:
    
    A(1) - B(2)  =>  P(3) ( total 6 )
    A(1) - B(3)  =>  P(2) ( total 6 )
    A(2) - B(1)  =>  P(3) ( total 6 )
    A(2) - B(3)  =>  P(1) ( total 6 )
    A(3) - B(1)  =>  P(2) ( total 6 )
    A(3) - B(2)  =>  P(1) ( total 6 )
    
      Therefore, a player can be sure that he won't lose if after his every
    move, the number of checkers left is 6k+1, 6k+2 or 6k+3
    (because the opponents can't remove less then 3 checkers together).
    
      So, the player who starts the game has a winning strategy for every
    N <> 6k+1 (from 6k+1 he cannot remove some checkers to reach another
    multiple of 6 + 1, 2 or 3).
    
      For N = 30, we should first remove 3 checkers, (30 - 3 = 27 = 6 * 4 + 3), 
    then complete the 6 checkers that are removed every round.

Mail to Ken