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

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

Created
Apr 06, 2017 at 22:58 by Martin Rubey
Updated
Apr 06, 2017 at 22:58 by Martin Rubey