cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A340458 Minimum length of the string over the alphabet of 3 or more symbols that has exactly n substring palindromes. Substrings are counted as distinct if they start at different offsets.

Original entry on oeis.org

1, 2, 2, 3, 4, 3, 4, 5, 5, 4, 5, 6, 6, 7, 5, 6, 7, 7, 8, 8, 6, 7, 8, 8, 9, 9, 9, 7, 8, 9, 9, 10, 10, 10, 11, 8, 9, 10, 10, 11, 11, 11, 12, 12, 9, 10, 11, 11, 12, 12, 12, 13, 13, 14, 10, 11, 12, 12, 13, 13, 13, 14, 14, 15, 14, 11, 12, 13, 13, 14, 14, 14, 15, 15, 16, 15, 16, 12, 13, 14, 14, 15, 15, 15, 16, 16, 17, 16, 17, 17
Offset: 1

Views

Author

Serguei Zolotov, Feb 13 2021

Keywords

Comments

The uploaded Python script uses G. Manacher's algorithm to efficiently calculate the number of palindromes.

Examples

			The string AAA with length 3 has 6 palindromic substrings:
    A starting at offset 1,
    A starting at offset 2,
    A starting at offset 3,
   AA starting at offset 1,
   AA starting at offset 2,
  AAA starting at offset 1.
There is no shorter string with exactly 6 substring palindromes. So a(6) = 3.
		

Formula

a(k*(k+1)/2) = k, from a string of k identical symbols.