

A206925


Number of contiguous palindromic bit patterns in the binary representation of n.


11



1, 2, 3, 4, 4, 4, 6, 7, 6, 6, 6, 6, 6, 7, 10, 11, 9, 8, 8, 8, 9, 8, 9, 9, 8, 8, 9, 9, 9, 11, 15, 16, 13, 11, 11, 11, 10, 10, 11, 11, 10, 12, 11, 10, 11, 11, 13, 13, 11, 10, 11, 10, 11, 11, 12, 12, 11, 11, 12, 13, 13, 16, 21, 22, 18, 15, 15, 14, 13, 13, 14, 14
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

The number of contiguous palindromic bit patterns in the binary representation of n is a measure for the grade of symmetry in an abstract arrangement of two kinds of elements (where the number of elements is the number of binary digits, of course).
The minimum value for a(n) is 2*floor(log_2(n)) and will be taken infinitely often (see A206926 and A206927). This means: For a given number of places m there are at least 2*(m1) palindromic substrings in the binary representation. This lower bound indicates to a certain extent the minimal possible symmetry.


LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Index entries for sequences related to binary expansion of n
Index entries for sequences related to palindromes


FORMULA

a(n) <= (m+1)*(m+2)/2, where m = floor(log_2(n)); equality holds if n + 1 is a power of 2.
a(n) >= 2*floor(log_2(n)).
This estimation cannot be improved in general, since equality holds for A206926(n): a(A206926(n)) = 2*floor(log_2(A206926(n))).
Asymptotic behavior:
a(n) = O(log(n)^2).
lim sup a(n)/log_2(n)^2 = 1/2, for n > infinity.
lim inf a(n)/log_2(n) = 2, for n > infinity.


EXAMPLE

a(1) = 1, since 1 = 1_2 is the only palindromic bit pattern;
a(4) = 4, since 4 = 100_2 and there are the following palindromic bit patterns: 1, 0, 0, 00;
a(5) = 4, since 5 = 101_2 and there are the following palindromic bit patterns: 1, 0, 1, 101;
a(8) = 7, since 8 = 1000_2 and there are the following palindromic bit patterns: 1, 0, 0, 0, 00, 00, 000.


PROG

(PARI) a(n)=n=binary(n); sum(k=0, #n1, sum(i=1, #nk, prod(j=0, k\2, n[i+j]==n[i+kj]))) \\ Charles R Greathouse IV, Mar 21 2012
(Haskell)
import Data.Map (fromList, (!), insert)
import Data.List (inits, tails)
a206925 n = a206925_list !! (n1)
a206925_list = 1 : f [0, 1] (fromList [(Bin [0], 1), (Bin [1], 1)]) where
f bs'@(b:bs) m = y : f (succ bs') (insert (Bin bs') y m) where
y = m ! (Bin bs) +
length (filter (\ds > ds == reverse ds) $ tail $ inits bs')
succ [] = [1]; succ (0:ds) = 1 : ds; succ (1:ds) = 0 : succ ds
 Reinhard Zumkeller, Dec 17 2012
(Smalltalk)
A206925
"Answers the number of symmetric bit patterns of n as a binary."
 m p q n numSym 
n := self.
n < 2 ifTrue: [^1].
m := n integerFloorLog: 2.
p := n printStringRadix: 2.
numSym := 0.
1 to: m + 1
do:
[:k 
1 to: k
do:
[:j 
q := p copyFrom: j to: k.
q = q reverse ifTrue: [numSym := numSym + 1]]].
^numSym // Hieronymus Fischer, Feb 16 2013


CROSSREFS

Cf. A006995, A206923, A206924, A206925, A206926, A070939.
Cf. A215244, A030308.
Sequence in context: A099777 A221917 A131798 * A114212 A108355 A057951
Adjacent sequences: A206922 A206923 A206924 * A206926 A206927 A206928


KEYWORD

nonn,base


AUTHOR

Hieronymus Fischer, Mar 12 2012


EXTENSIONS

Comments and formulas added by Hieronymus Fischer, Jan 23 2013


STATUS

approved



