OFFSET
0,1
COMMENTS
LINKS
Michael S. Branicky, Table of n, a(n) for n = 0..10000
A. Glen, J. Justin, S. Widmer, and L. Q. Zamboni, Palindromic Richness, arXiv:0801.1656 [math.CO], 2008.
EXAMPLE
For n=10 the binary representation is A007088(10)=1010, which contains the a(10)=5 palindromic substrings {}, {0}, {1}, {101}, {010}. The empty subword is always included in the count.
PROG
(Python)
def ispal(s): return s == s[::-1]
def a(n):
s = bin(n)[2:]
return 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([a(n) for n in range(105)]) # Michael S. Branicky, Feb 02 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
R. J. Mathar, Apr 11 2008
STATUS
approved