OFFSET
1,1
COMMENTS
A word of length k is "rich" if it contains, as contiguous subsequences, exactly k + 1 distinct palindromes (including the empty word).
There are A225681(k)/2 terms with k binary digits.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
For n = 203:
- the binary expansion of 203 is "11001011" and has 8 binary digits,
- we have the following 8 palindromes: "", "0", "1", "00", "11", "010", "101", "1001"
- so 203 is not rich, and belongs to this sequence.
For n = 204:
- the binary expansion of 204 is "11001100" and has 8 binary digits,
- we have the following 9 palindromes: "", "0", "1", "00", "11", "0110", "1001", "001100", "110011"
- so 204 is rich, and does not belong to this sequence.
MATHEMATICA
Select[Range@1000, Length@Select[Union[Subsequences[s=IntegerDigits[#, 2]]], PalindromeQ]<=Length@s&] (* Giorgos Kalogeropoulos, Oct 29 2021 *)
PROG
(PARI) is(n) = { my (b=binary(n), p=select(w->w==Vecrev(w), setbinop((i, j)->b[i..j], [1..#b]))); #b!=#p }
(Python)
def ispal(s): return s == s[::-1]
def ok(n):
s = bin(n)[2:]
return len(s) >= 1 + len(set(s[i:j] for i in range(len(s)) for j in range(i+1, len(s)+1) if ispal(s[i:j])))
print([k for k in range(870) if ok(k)]) # Michael S. Branicky, Oct 29 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 28 2021
STATUS
approved