%I #8 Feb 03 2018 08:56:38
%S 0,1,0,1,3,0,2,1,5,3,4,0,7,2,6,1,9,5,8,3,11,4,10,0,13,7,12,2,15,6,14,
%T 1,17,9,16,5,19,8,18,3,21,11,20,4,23,10,22,0,25,13,24
%N The Grundy number of restricted Nim with a pass move.
%C These are the Grundy values or nim-values for heaps of n beans in the game where you're allowed to take up to half of the beans in a heap and you can use a one-time pass, i.e., a pass move which may be used at most once in a game, and not from a terminal position. Once the pass has been used by either player, it is no longer available. If the pass move were not allowed, then this game would be the same as the one in A025480.
%F a(4k) = 2k+1; a(4k+2) = 2k; a(4k+3) = a(2k+1); a(8k+1) = 2k+1; a(8k+5) = 2k.
%t f[n_] := Which[IntegerQ[n/4], (n + 2)/2, IntegerQ[(n - 2)/4], (n - 2)/2,
%t IntegerQ[(n - 3)/4], f[(n - 1)/2], IntegerQ[(n - 1)/8], (n + 3)/4,
%t IntegerQ[(n - 5)/8], (n - 5)/4];
%t (* the following is Mathematica program to generate the same sequence as Grundy numbers *)
%t ss = 50; allcases = Flatten[Table[Table[{a, pass}, {a, 0, ss}], {pass, 0, 1}], 1];
%t move[z_] := Block[{p}, p = z;
%t a = p[[1]]; pass = p[[2]]; c0 = Floor[a/2];
%t Which[a > 0 && pass == 1,
%t Union[Table[{a - x, pass}, {x, 1, c0}], {{a, 0}}], a > 0,
%t Table[{a - x, pass}, {x, 1, c0}], a == 0, {}]];
%t Mex[L_] := Min[Complement[Range[0, Length[L]], L]];
%t Gr2[pos_] := Gr2[pos] = Mex[Map[Gr2, move[pos]]];
%t pposition = Select[allcases, Gr2[#] == 0 &];
%t Table[Gr2[{n, 1}], {n, 0, 50}]
%Y Cf. A025480.
%K nonn
%O 0,5
%A _Ryouhei Miyadera_, Mariko Kashihara and Koh Oomori, Nov 12 2012
|