

A295041


The Grundy number of restricted Nim with a pass move.


0



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, 1, 17, 9, 16, 5, 19, 8, 18, 3, 21, 11, 20, 4, 23, 10, 22, 0, 25, 13, 24
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,5


COMMENTS

These are the Grundy values or nimvalues 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 onetime 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.


LINKS

Table of n, a(n) for n=0..50.


FORMULA

a(4k) = 2k+1; a(4k+2) = 2k; a(4k+3) = a(2k+1); a(8k+1) = 2k+1; a(8k+5) = 2k.


MATHEMATICA

f[n_] := Which[IntegerQ[n/4], (n + 2)/2, IntegerQ[(n  2)/4], (n  2)/2,
IntegerQ[(n  3)/4], f[(n  1)/2], IntegerQ[(n  1)/8], (n + 3)/4,
IntegerQ[(n  5)/8], (n  5)/4];
(* the following is Mathematica program to generate the same sequence as Grundy numbers *)
ss = 50; allcases = Flatten[Table[Table[{a, pass}, {a, 0, ss}], {pass, 0, 1}], 1];
move[z_] := Block[{p}, p = z;
a = p[[1]]; pass = p[[2]]; c0 = Floor[a/2];
Which[a > 0 && pass == 1,
Union[Table[{a  x, pass}, {x, 1, c0}], {{a, 0}}], a > 0,
Table[{a  x, pass}, {x, 1, c0}], a == 0, {}]];
Mex[L_] := Min[Complement[Range[0, Length[L]], L]];
Gr2[pos_] := Gr2[pos] = Mex[Map[Gr2, move[pos]]];
pposition = Select[allcases, Gr2[#] == 0 &];
Table[Gr2[{n, 1}], {n, 0, 50}]


CROSSREFS

Cf. A025480.
Sequence in context: A165066 A034389 A084196 * A127913 A135991 A331422
Adjacent sequences: A295038 A295039 A295040 * A295042 A295043 A295044


KEYWORD

nonn


AUTHOR

Ryouhei Miyadera, Mariko Kashihara and Koh Oomori, Nov 12 2012


STATUS

approved



