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.

A137397 Number of distinct palindromic subwords in the binary representation of n.

This page as a plain text file.
%I A137397 #17 Feb 03 2021 13:51:56
%S A137397 2,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,
%T A137397 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,
%U A137397 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
%N A137397 Number of distinct palindromic subwords in the binary representation of n.
%C A137397 Equals A070941 from a(1) to a(202) and continues a(203)=8, a(204)=a(205)=9.
%C A137397 Omitting "distinct" in the definition, we get 1, 2, 4, 4, 7, 7, 7, 7, 11, 11, 11, 11, 11, 11, 11, 11, 16, 16,... which apparently is built by repeating entries of A000124 in blocks of length 2,4,8,16,32..
%H A137397 Michael S. Branicky, <a href="/A137397/b137397.txt">Table of n, a(n) for n = 0..10000</a>
%H A137397 A. Glen, J. Justin, S. Widmer, and L. Q. Zamboni, <a href="https://arxiv.org/abs/0801.1656">Palindromic Richness</a>, arXiv:0801.1656 [math.CO], 2008.
%e A137397 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.
%o A137397 (Python)
%o A137397 def ispal(s): return s == s[::-1]
%o A137397 def a(n):
%o A137397   s = bin(n)[2:]
%o A137397   return 1 + len(set(s[i:j] for i in range(len(s))
%o A137397     for j in range(i+1, len(s)+1) if ispal(s[i:j])))
%o A137397 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Feb 02 2021
%Y A137397 Cf. A070941.
%K A137397 nonn,base
%O A137397 0,1
%A A137397 _R. J. Mathar_, Apr 11 2008