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

Created
Jun 11, 2019 at 11:28 by Martin Rubey
Updated
Jun 11, 2019 at 11:28 by Martin Rubey