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