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.

A380596 Numbers with embedded palindromes as proper substrings of the term.

Original entry on oeis.org

100, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 122, 133, 144, 155, 166, 177, 188, 199, 200, 211, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 233, 244, 255, 266, 277, 288, 299, 300, 311, 322, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 344, 355, 366, 377, 388, 399
Offset: 1

Views

Author

James S. DeArmon, Jan 27 2025

Keywords

Comments

An embedded palindrome is a substring of at least two contiguous digits (since a single digit is trivially a palindrome). E.g., 121 is a palindrome, but has no embedded palindromes; 110 has the embedded palindrome "11".
Alternatively, k contains a proper substring of the form dd or ded, where d and e are single decimal digits (i.e., a length-2 or -3 palindrome). - Michael S. Branicky, Feb 08 2025

Examples

			100 is a term, since "00" is a palindrome; 1001 is a term for the same reason.
1020 is a term, since "020" is a palindrome; 10201 is a term for the same reason.
		

Crossrefs

Cf. A002113.
Significant overlap with A044821 for terms below 1000.

Programs

  • Python
    from itertools import combinations
    def get_all_substrings(string):
        length = len(string) + 1
        return [string[x:y] for x, y in combinations(range(length), r=2)]
    def is_palindrome(n):
        return str(n) == str(n)[::-1]
    def ok(n):
        subsets = get_all_substrings(str(n))
        subsets = [subset for subset in subsets if is_palindrome(subset) and len(subset)>1 and len(subset)0
    print([k for k in range (100,400) if ok(k)])
    
  • Python
    def ok(n):
        s = str(n)
        return any(p == p[::-1] and len(p) < len(s) for p in (s[i:i+j] for j in (2, 3) for i in range(len(s)-j+1)))
    print([k for k in range(400) if ok(k)]) # Michael S. Branicky, Feb 08 2025