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

    return len(w)

Created
Mar 19, 2019 at 23:08 by Martin Rubey
Updated
Mar 19, 2019 at 23:08 by Martin Rubey