login
A380596
Numbers with embedded palindromes as proper substrings of the term.
0
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,1
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
EXAMPLE
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.
PROG
(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)<len(str(n))]
return len(subsets)>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
CROSSREFS
Cf. A002113.
Significant overlap with A044821 for terms below 1000.
Sequence in context: A352440 A204589 A134496 * A191752 A165406 A135603
KEYWORD
nonn,base
AUTHOR
James S. DeArmon, Jan 27 2025
STATUS
approved