Identifier
Identifier
Values
0 => 0
1 => 0
00 => 0
01 => 1
10 => 0
11 => 0
000 => 0
001 => 2
010 => 1
011 => 2
100 => 0
101 => 1
110 => 0
111 => 0
0000 => 0
0001 => 3
0010 => 2
0011 => 0
0100 => 1
0101 => 1
0110 => 2
0111 => 3
1000 => 0
1001 => 2
1010 => 1
1011 => 2
1100 => 0
1101 => 1
1110 => 0
1111 => 0
00000 => 0
00001 => 4
00010 => 3
00011 => 6
00100 => 2
00101 => 5
00110 => 0
00111 => 6
01000 => 1
01001 => 4
01010 => 1
01011 => 5
01100 => 2
01101 => 4
01110 => 3
01111 => 4
10000 => 0
10001 => 3
10010 => 2
10011 => 0
10100 => 1
10101 => 1
10110 => 2
10111 => 3
11000 => 0
11001 => 2
11010 => 1
11011 => 2
11100 => 0
11101 => 1
11110 => 0
11111 => 0
000000 => 0
000001 => 5
000010 => 4
000011 => 0
000100 => 3
000101 => 5
000110 => 6
000111 => 1
001000 => 2
001001 => 6
001010 => 5
001011 => 0
001100 => 0
001101 => 7
001110 => 6
001111 => 0
010000 => 1
010001 => 3
010010 => 4
010011 => 7
010100 => 1
010101 => 0
010110 => 5
010111 => 5
011000 => 2
011001 => 1
011010 => 4
011011 => 6
011100 => 3
011101 => 3
011110 => 4
011111 => 5
100000 => 0
100001 => 4
100010 => 3
100011 => 6
100100 => 2
100101 => 5
100110 => 0
100111 => 6
101000 => 1
101001 => 4
101010 => 1
101011 => 5
101100 => 2
101101 => 4
101110 => 3
101111 => 4
110000 => 0
110001 => 3
110010 => 2
110011 => 0
110100 => 1
110101 => 1
110110 => 2
110111 => 3
111000 => 0
111001 => 2
111010 => 1
111011 => 2
111100 => 0
111101 => 1
111110 => 0
111111 => 0
0000000 => 0
0000001 => 6
0000010 => 5
0000011 => 2
0000100 => 4
0000101 => 1
0000110 => 0
0000111 => 4
0001000 => 3
0001001 => 4
0001010 => 5
0001011 => 3
0001100 => 6
0001101 => 2
0001110 => 1
0001111 => 4
0010000 => 2
0010001 => 3
0010010 => 6
0010011 => 6
0010100 => 5
0010101 => 7
0010110 => 0
0010111 => 3
0011000 => 0
0011001 => 0
0011010 => 7
0011011 => 6
0011100 => 6
0011101 => 5
0011110 => 0
0011111 => 2
0100000 => 1
0100001 => 6
0100010 => 3
0100011 => 5
0100100 => 4
0100101 => 0
0100110 => 7
0100111 => 2
0101000 => 1
0101001 => 7
0101010 => 0
0101011 => 7
0101100 => 5
0101101 => 0
0101110 => 5
0101111 => 1
0110000 => 2
0110001 => 2
0110010 => 1
0110011 => 0
0110100 => 4
0110101 => 7
0110110 => 6
0110111 => 4
0111000 => 3
0111001 => 2
0111010 => 3
0111011 => 3
0111100 => 4
0111101 => 6
0111110 => 5
0111111 => 6
1000000 => 0
1000001 => 5
1000010 => 4
1000011 => 0
1000100 => 3
1000101 => 5
1000110 => 6
1000111 => 1
1001000 => 2
1001001 => 6
1001010 => 5
1001011 => 0
1001100 => 0
1001101 => 7
1001110 => 6
1001111 => 0
1010000 => 1
1010001 => 3
1010010 => 4
1010011 => 7
1010100 => 1
1010101 => 0
1010110 => 5
1010111 => 5
1011000 => 2
1011001 => 1
1011010 => 4
1011011 => 6
1011100 => 3
1011101 => 3
1011110 => 4
1011111 => 5
1100000 => 0
1100001 => 4
1100010 => 3
1100011 => 6
1100100 => 2
1100101 => 5
1100110 => 0
1100111 => 6
1101000 => 1
1101001 => 4
1101010 => 1
1101011 => 5
1101100 => 2
1101101 => 4
1101110 => 3
1101111 => 4
1110000 => 0
1110001 => 3
1110010 => 2
1110011 => 0
1110100 => 1
1110101 => 1
1110110 => 2
1110111 => 3
1111000 => 0
1111001 => 2
1111010 => 1
1111011 => 2
1111100 => 0
1111101 => 1
1111110 => 0
1111111 => 0
00000000 => 0
00000001 => 7
00000010 => 6
00000011 => 0
00000100 => 5
00000101 => 1
00000110 => 2
00000111 => 7
00001000 => 4
00001001 => 2
00001010 => 1
00001011 => 6
00001100 => 0
00001101 => 5
00001110 => 4
00001111 => 0
00010000 => 3
00010001 => 3
00010010 => 4
00010011 => 5
00010100 => 5
00010101 => 6
00010110 => 3
00010111 => 1
00011000 => 6
00011001 => 7
00011010 => 2
00011011 => 2
00011100 => 1
00011101 => 3
00011110 => 4
00011111 => 7
00100000 => 2
00100001 => 4
00100010 => 3
00100011 => 4
00100100 => 6
00100101 => 3
00100110 => 6
00100111 => 2
00101000 => 5
00101001 => 2
00101010 => 7
00101011 => 1
00101100 => 0
00101101 => 4
00101110 => 3
00101111 => 6
00110000 => 0
00110001 => 1
00110010 => 0
00110011 => 0
00110100 => 7
00110101 => 5
00110110 => 6
00110111 => 5
00111000 => 6
00111001 => 6
00111010 => 5
00111011 => 4
00111100 => 0
00111101 => 3
00111110 => 2
00111111 => 0
01000000 => 1
01000001 => 5
01000010 => 6
01000011 => 3
01000100 => 3
01000101 => 4
01000110 => 5
01000111 => 3
01001000 => 4
01001001 => 1
01001010 => 0
01001011 => 4
01001100 => 7
01001101 => 1
01001110 => 2
01001111 => 5
01010000 => 1
01010001 => 2
01010010 => 7
01010011 => 5
01010100 => 0
01010101 => 0
01010110 => 7
01010111 => 6
01011000 => 5
01011001 => 7
01011010 => 0
01011011 => 3
01011100 => 5
01011101 => 4
01011110 => 1
01011111 => 1
01100000 => 2
01100001 => 7
01100010 => 2
01100011 => 6
01100100 => 1
01100101 => 7
01100110 => 0
01100111 => 7
01101000 => 4
01101001 => 0
01101010 => 7
01101011 => 2
01101100 => 6
01101101 => 1
01101110 => 4
01101111 => 2
01110000 => 3
01110001 => 1
01110010 => 2
01110011 => 1
01110100 => 3
01110101 => 2
01110110 => 3
01110111 => 3
01111000 => 4
01111001 => 7
01111010 => 6
01111011 => 4
01111100 => 5
01111101 => 5
01111110 => 6
01111111 => 7
10000000 => 0
10000001 => 6
10000010 => 5
10000011 => 2
10000100 => 4
10000101 => 1
10000110 => 0
10000111 => 4
10001000 => 3
10001001 => 4
10001010 => 5
10001011 => 3
10001100 => 6
10001101 => 2
10001110 => 1
10001111 => 4
10010000 => 2
10010001 => 3
10010010 => 6
10010011 => 6
10010100 => 5
10010101 => 7
10010110 => 0
10010111 => 3
10011000 => 0
10011001 => 0
10011010 => 7
10011011 => 6
10011100 => 6
10011101 => 5
10011110 => 0
10011111 => 2
10100000 => 1
10100001 => 6
10100010 => 3
10100011 => 5
10100100 => 4
10100101 => 0
10100110 => 7
10100111 => 2
10101000 => 1
10101001 => 7
10101010 => 0
10101011 => 7
10101100 => 5
10101101 => 0
10101110 => 5
10101111 => 1
10110000 => 2
10110001 => 2
10110010 => 1
10110011 => 0
10110100 => 4
10110101 => 7
10110110 => 6
10110111 => 4
10111000 => 3
10111001 => 2
10111010 => 3
10111011 => 3
10111100 => 4
10111101 => 6
10111110 => 5
10111111 => 6
11000000 => 0
11000001 => 5
11000010 => 4
11000011 => 0
11000100 => 3
11000101 => 5
11000110 => 6
11000111 => 1
11001000 => 2
11001001 => 6
11001010 => 5
11001011 => 0
11001100 => 0
11001101 => 7
11001110 => 6
11001111 => 0
11010000 => 1
11010001 => 3
11010010 => 4
11010011 => 7
11010100 => 1
11010101 => 0
11010110 => 5
11010111 => 5
11011000 => 2
11011001 => 1
11011010 => 4
11011011 => 6
11011100 => 3
11011101 => 3
11011110 => 4
11011111 => 5
11100000 => 0
11100001 => 4
11100010 => 3
11100011 => 6
11100100 => 2
11100101 => 5
11100110 => 0
11100111 => 6
11101000 => 1
11101001 => 4
11101010 => 1
11101011 => 5
11101100 => 2
11101101 => 4
11101110 => 3
11101111 => 4
11110000 => 0
11110001 => 3
11110010 => 2
11110011 => 0
11110100 => 1
11110101 => 1
11110110 => 2
11110111 => 3
11111000 => 0
11111001 => 2
11111010 => 1
11111011 => 2
11111100 => 0
11111101 => 1
11111110 => 0
11111111 => 0
000000000 => 0
000000001 => 8
000000010 => 7
000000011 => 14
000000100 => 6
000000101 => 13
000000110 => 0
000000111 => 10
000001000 => 5
000001001 => 12
000001010 => 1
000001011 => 9
000001100 => 2
000001101 => 8
000001110 => 7
000001111 => 12
000010000 => 4
000010001 => 11
000010010 => 2
000010011 => 12
000010100 => 1
000010101 => 13
000010110 => 6
000010111 => 11
000011000 => 0
000011001 => 14
000011010 => 5
000011011 => 10
000011100 => 4
000011101 => 9
000011110 => 0
000011111 => 12
000100000 => 3
000100001 => 10
000100010 => 3
000100011 => 11
000100100 => 4
000100101 => 14
000100110 => 5
000100111 => 14
000101000 => 5
000101001 => 13
000101010 => 6
000101011 => 15
000101100 => 3
000101101 => 8
000101110 => 1
000101111 => 11
000110000 => 6
000110001 => 8
000110010 => 7
000110011 => 8
000110100 => 2
000110101 => 15
000110110 => 2
000110111 => 14
000111000 => 1
000111001 => 14
000111010 => 3
000111011 => 13
000111100 => 4
000111101 => 8
000111110 => 7
000111111 => 10
001000000 => 2
001000001 => 9
001000010 => 4
001000011 => 14
001000100 => 3
001000101 => 11
001000110 => 4
001000111 => 13
001001000 => 6
001001001 => 12
001001010 => 3
001001011 => 8
001001100 => 6
001001101 => 15
001001110 => 2
001001111 => 10
001010000 => 5
001010001 => 9
001010010 => 2
001010011 => 15
001010100 => 7
001010101 => 8
001010110 => 1
001010111 => 15
001011000 => 0
001011001 => 13
001011010 => 4
001011011 => 8
001011100 => 3
001011101 => 13
001011110 => 6
001011111 => 9
001100000 => 0
001100001 => 10
001100010 => 1
001100011 => 10
001100100 => 0
001100101 => 9
001100110 => 0
001100111 => 8
001101000 => 7
001101001 => 12
001101010 => 5
001101011 => 15
001101100 => 6
001101101 => 14
001101110 => 5
001101111 => 12
001110000 => 6
001110001 => 11
001110010 => 6
001110011 => 10
001110100 => 5
001110101 => 11
001110110 => 4
001110111 => 11
001111000 => 0
001111001 => 12
001111010 => 3
001111011 => 14
001111100 => 2
001111101 => 13
001111110 => 0
001111111 => 14
010000000 => 1
010000001 => 8
010000010 => 5
010000011 => 13
010000100 => 6
010000101 => 12
010000110 => 3
010000111 => 8
010001000 => 3
010001001 => 11
010001010 => 4
010001011 => 13
010001100 => 5
010001101 => 14
010001110 => 3
010001111 => 9
010010000 => 4
010010001 => 10
010010010 => 1
010010011 => 14
010010100 => 0
010010101 => 13
010010110 => 4
010010111 => 8
010011000 => 7
010011001 => 8
010011010 => 1
010011011 => 15
010011100 => 2
010011101 => 14
010011110 => 5
010011111 => 8
010100000 => 1
010100001 => 9
010100010 => 2
010100011 => 11
010100100 => 7
010100101 => 12
010100110 => 5
010100111 => 15
010101000 => 0
010101001 => 9
010101010 => 0
010101011 => 8
010101100 => 7
010101101 => 13
010101110 => 6
010101111 => 13
010110000 => 5
010110001 => 10
010110010 => 7
010110011 => 9
010110100 => 0
010110101 => 12
010110110 => 3
010110111 => 14
010111000 => 5
010111001 => 11
010111010 => 4
010111011 => 11
010111100 => 1
010111101 => 12
010111110 => 1
010111111 => 13
011000000 => 2
011000001 => 8
011000010 => 7
011000011 => 12
011000100 => 2
011000101 => 11
011000110 => 6
011000111 => 14
011001000 => 1
011001001 => 10
011001010 => 7
011001011 => 13
011001100 => 0
011001101 => 8
011001110 => 7
011001111 => 14
011010000 => 4
011010001 => 9
011010010 => 0
011010011 => 12
011010100 => 7
011010101 => 9
011010110 => 2
011010111 => 13
011011000 => 6
011011001 => 10
011011010 => 1
011011011 => 12
011011100 => 4
011011101 => 11
011011110 => 2
011011111 => 12
011100000 => 3
011100001 => 8
011100010 => 1
011100011 => 11
011100100 => 2
011100101 => 10
011100110 => 1
011100111 => 8
011101000 => 3
011101001 => 9
011101010 => 2
011101011 => 9
011101100 => 3
011101101 => 10
011101110 => 3
011101111 => 11
011110000 => 4
011110001 => 8
011110010 => 7
011110011 => 10
011110100 => 6
011110101 => 9
011110110 => 4
011110111 => 10
011111000 => 5
011111001 => 8
011111010 => 5
011111011 => 9
011111100 => 6
011111101 => 8
011111110 => 7
011111111 => 8
100000000 => 0
100000001 => 7
100000010 => 6
100000011 => 0
100000100 => 5
100000101 => 1
100000110 => 2
100000111 => 7
100001000 => 4
100001001 => 2
100001010 => 1
100001011 => 6
100001100 => 0
100001101 => 5
100001110 => 4
100001111 => 0
100010000 => 3
100010001 => 3
100010010 => 4
100010011 => 5
100010100 => 5
100010101 => 6
100010110 => 3
100010111 => 1
100011000 => 6
100011001 => 7
100011010 => 2
100011011 => 2
100011100 => 1
100011101 => 3
100011110 => 4
100011111 => 7
100100000 => 2
100100001 => 4
100100010 => 3
100100011 => 4
100100100 => 6
100100101 => 3
100100110 => 6
100100111 => 2
100101000 => 5
100101001 => 2
100101010 => 7
100101011 => 1
100101100 => 0
100101101 => 4
100101110 => 3
100101111 => 6
100110000 => 0
100110001 => 1
100110010 => 0
100110011 => 0
100110100 => 7
100110101 => 5
100110110 => 6
100110111 => 5
100111000 => 6
100111001 => 6
100111010 => 5
100111011 => 4
100111100 => 0
100111101 => 3
100111110 => 2
100111111 => 0
101000000 => 1
101000001 => 5
101000010 => 6
101000011 => 3
101000100 => 3
101000101 => 4
101000110 => 5
101000111 => 3
101001000 => 4
101001001 => 1
101001010 => 0
101001011 => 4
101001100 => 7
101001101 => 1
101001110 => 2
101001111 => 5
101010000 => 1
101010001 => 2
101010010 => 7
101010011 => 5
101010100 => 0
101010101 => 0
101010110 => 7
101010111 => 6
101011000 => 5
101011001 => 7
101011010 => 0
101011011 => 3
101011100 => 5
101011101 => 4
101011110 => 1
101011111 => 1
101100000 => 2
101100001 => 7
101100010 => 2
101100011 => 6
101100100 => 1
101100101 => 7
101100110 => 0
101100111 => 7
101101000 => 4
101101001 => 0
101101010 => 7
101101011 => 2
101101100 => 6
101101101 => 1
101101110 => 4
101101111 => 2
101110000 => 3
101110001 => 1
101110010 => 2
101110011 => 1
101110100 => 3
101110101 => 2
101110110 => 3
101110111 => 3
101111000 => 4
101111001 => 7
101111010 => 6
101111011 => 4
101111100 => 5
101111101 => 5
101111110 => 6
101111111 => 7
110000000 => 0
110000001 => 6
110000010 => 5
110000011 => 2
110000100 => 4
110000101 => 1
110000110 => 0
110000111 => 4
110001000 => 3
110001001 => 4
110001010 => 5
110001011 => 3
110001100 => 6
110001101 => 2
110001110 => 1
110001111 => 4
110010000 => 2
110010001 => 3
110010010 => 6
110010011 => 6
110010100 => 5
110010101 => 7
110010110 => 0
110010111 => 3
110011000 => 0
110011001 => 0
110011010 => 7
110011011 => 6
110011100 => 6
110011101 => 5
110011110 => 0
110011111 => 2
110100000 => 1
110100001 => 6
110100010 => 3
110100011 => 5
110100100 => 4
110100101 => 0
110100110 => 7
110100111 => 2
110101000 => 1
110101001 => 7
110101010 => 0
110101011 => 7
110101100 => 5
110101101 => 0
110101110 => 5
110101111 => 1
110110000 => 2
110110001 => 2
110110010 => 1
110110011 => 0
110110100 => 4
110110101 => 7
110110110 => 6
110110111 => 4
110111000 => 3
110111001 => 2
110111010 => 3
110111011 => 3
110111100 => 4
110111101 => 6
110111110 => 5
110111111 => 6
111000000 => 0
111000001 => 5
111000010 => 4
111000011 => 0
111000100 => 3
111000101 => 5
111000110 => 6
111000111 => 1
111001000 => 2
111001001 => 6
111001010 => 5
111001011 => 0
111001100 => 0
111001101 => 7
111001110 => 6
111001111 => 0
111010000 => 1
111010001 => 3
111010010 => 4
111010011 => 7
111010100 => 1
111010101 => 0
111010110 => 5
111010111 => 5
111011000 => 2
111011001 => 1
111011010 => 4
111011011 => 6
111011100 => 3
111011101 => 3
111011110 => 4
111011111 => 5
111100000 => 0
111100001 => 4
111100010 => 3
111100011 => 6
111100100 => 2
111100101 => 5
111100110 => 0
111100111 => 6
111101000 => 1
111101001 => 4
111101010 => 1
111101011 => 5
111101100 => 2
111101101 => 4
111101110 => 3
111101111 => 4
111110000 => 0
111110001 => 3
111110010 => 2
111110011 => 0
111110100 => 1
111110101 => 1
111110110 => 2
111110111 => 3
111111000 => 0
111111001 => 2
111111010 => 1
111111011 => 2
111111100 => 0
111111101 => 1
111111110 => 0
111111111 => 0
0000000000 => 0
0000000001 => 9
0000000010 => 8
0000000011 => 0
0000000100 => 7
0000000101 => 13
0000000110 => 14
0000000111 => 5
0000001000 => 6
0000001001 => 14
0000001010 => 13
0000001011 => 4
0000001100 => 0
0000001101 => 11
0000001110 => 10
0000001111 => 0
0000010000 => 5
0000010001 => 11
0000010010 => 12
0000010011 => 3
0000010100 => 1
0000010101 => 12
0000010110 => 9
0000010111 => 5
0000011000 => 2
0000011001 => 13
0000011010 => 8
0000011011 => 6
0000011100 => 7
0000011101 => 11
0000011110 => 12
0000011111 => 1
0000100000 => 4
0000100001 => 12
0000100010 => 11
0000100011 => 2
0000100100 => 2
0000100101 => 9
0000100110 => 12
0000100111 => 6
0000101000 => 1
0000101001 => 8
0000101010 => 13
0000101011 => 5
0000101100 => 6
0000101101 => 12
0000101110 => 11
0000101111 => 0
0000110000 => 0
0000110001 => 15
0000110010 => 14
0000110011 => 0
0000110100 => 5
0000110101 => 9
0000110110 => 10
0000110111 => 7
0000111000 => 4
0000111001 => 10
0000111010 => 9
0000111011 => 6
0000111100 => 0
0000111101 => 13
0000111110 => 12
0000111111 => 0
0001000000 => 3
0001000001 => 9
0001000010 => 10
0001000011 => 1
0001000100 => 3
0001000101 => 10
0001000110 => 11
0001000111 => 3
0001001000 => 4
0001001001 => 15
0001001010 => 14
0001001011 => 4
0001001100 => 5
0001001101 => 13
0001001110 => 14
0001001111 => 7
0001010000 => 5
0001010001 => 8
0001010010 => 13
0001010011 => 1
0001010100 => 6
0001010101 => 8
0001010110 => 15
0001010111 => 0
0001011000 => 3
0001011001 => 15
0001011010 => 8
0001011011 => 5
0001011100 => 1
0001011101 => 14
0001011110 => 11
0001011111 => 5
0001100000 => 6
0001100001 => 13
0001100010 => 8
0001100011 => 2
0001100100 => 7
0001100101 => 15
0001100110 => 8
0001100111 => 1
0001101000 => 2
0001101001 => 8
0001101010 => 15
0001101011 => 4
0001101100 => 2
0001101101 => 11
0001101110 => 14
0001101111 => 6
0001110000 => 1
0001110001 => 13
0001110010 => 14
0001110011 => 3
0001110100 => 3
0001110101 => 12
0001110110 => 13
0001110111 => 3
0001111000 => 4
0001111001 => 9
0001111010 => 8
0001111011 => 4
0001111100 => 7
0001111101 => 9
0001111110 => 10
0001111111 => 5
0010000000 => 2
0010000001 => 10
0010000010 => 9
0010000011 => 0
0010000100 => 4
0010000101 => 15
0010000110 => 14
0010000111 => 4
0010001000 => 3
0010001001 => 10
0010001010 => 11
0010001011 => 3
0010001100 => 4
0010001101 => 14
0010001110 => 13
0010001111 => 6
0010010000 => 6
0010010001 => 9
0010010010 => 12
0010010011 => 2
0010010100 => 3
0010010101 => 15
0010010110 => 8
0010010111 => 5
0010011000 => 6
0010011001 => 8
0010011010 => 15
0010011011 => 0
0010011100 => 2
0010011101 => 15
0010011110 => 10
0010011111 => 6
0010100000 => 5
0010100001 => 12
0010100010 => 9
0010100011 => 1
0010100100 => 2
0010100101 => 8
0010100110 => 15
0010100111 => 4
0010101000 => 7
0010101001 => 15
0010101010 => 8
0010101011 => 1
0010101100 => 1
0010101101 => 10
0010101110 => 15
0010101111 => 5
0010110000 => 0
0010110001 => 14
click to show generating function       
Description
The Grundy value of Welter's game on a binary word.
Two players take turns moving a $1$ to the left. The loosing positions are the words $1\dots 10\dots 0$.
References
[1] Nowakowski, R. J. $…$, Welter's Game, Sylver Coinage, Dots-and-Boxes,$\,…$ MathSciNet:1095544
Code
@cached_function
def statistic(w):
    """Return the Grundy value of the binary word w for Welter's game.

    sage: statistic((0,)*3 + (1,) + (0,)*15 + (1,))
    15

    sage: statistic((0,)*7 + (1,) + (0,)*15 + (1,))
    15

    sage: statistic((0,)*5 + (1,) + (0,)*7 + (1,))
    7

    sage: statistic((0,)*11 + (1,) + (0,)*5 + (1,))
    25

    sage: statistic((0,0,1))
    2

    sage: statistic(tuple(1 if is_prime(i) else 0 for i in range(24)))
    28
    """
    def children(w):
        for i in range(len(w)):
            if w[i] == 1:
                for j in range(i):
                    if w[j] == 0:
                        yield w[:j] + (1,) + w[j+1:i] + (0,) + w[i+1:]

    l = [statistic(tuple(v)) for v in children(tuple(w))]
    i = 0
    while i in l:
        i += 1
    return i

Created
Jan 06, 2017 at 20:23 by Martin Rubey
Updated
Jan 06, 2017 at 20:23 by Martin Rubey