[go: up one dir, main page]

login
Search: a206927 -id:a206927
     Sort: relevance | references | number | modified | created      Format: long | short | data
Number of contiguous palindromic bit patterns in the binary representation of n.
+10
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
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*(m-1) palindromic substrings in the binary representation. This lower bound indicates to a certain extent the minimal possible symmetry.
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, #n-1, sum(i=1, #n-k, prod(j=0, k\2, n[i+j]==n[i+k-j]))) \\ Charles R Greathouse IV, Mar 21 2012
(Haskell)
import Data.Map (fromList, (!), insert)
import Data.List (inits, tails)
a206925 n = a206925_list !! (n-1)
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)
"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
(Python)
def A206925(n):
s = bin(n)[2:]
k = len(s)
return sum(1 for i in range(k) for j in range(i+1, k+1) if s[i:j] == s[j-1:i-1-k:-1]) # Chai Wah Wu, Jan 31 2023
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Mar 12 2012
EXTENSIONS
Comments and formulas added by Hieronymus Fischer, Jan 23 2013
STATUS
approved
Numbers such that the number of contiguous palindromic bit patterns in their binary representation is minimal (for a given number of places).
+10
10
2, 4, 5, 6, 9, 10, 11, 12, 13, 18, 19, 20, 22, 25, 26, 37, 38, 41, 44, 50, 52, 75, 77, 83, 89, 101, 105, 150, 154, 166, 178, 203, 211, 300, 308, 333, 357, 406, 422, 601, 617, 666, 715, 812, 845, 1202, 1235, 1332, 1430, 1625, 1690, 2405, 2470, 2665, 2860, 3250
OFFSET
1,1
COMMENTS
The only binary palindromes in the sequence are 5 and 9.
The sequence is infinite, since A206927 is an infinite subsequence.
a(n) is the least number > a(n-1) which have the same number of palindromic substrings than a(n-1). If such a number doesn't exist, a(n) is the least number with one additional digit which meets the minimal possible number of palindromic substrings for such increased number of digits.
The concatenation of the bit patterns of a(n) and the reversal of a(n) form a term of A217099. Same is true for the concatenation of the bit patterns of a(n) and the reversal of floor(a(n)/2).
For a given number of places m there are at least 2*(m-1) palindromic substrings in the binary representation (cf. A206925). According to the definition the sequence terms are those with minimal possible symmetry. In other words: numbers not in the sequence have a significantly 'higher grade of symmetry'.
The terms have characteristic bit patterns and can be subdivided into 6 different classes of minimal symmetry. There are the following basic bit patterns: '100101', '100110', '101001', '101100', '110010' and '110100' representing the numbers 37, 38, 41, 44, 50 and 52. Numbers which are not a concatenation of one of these basic bit patterns do not meet the minimality condition. Evidently, 37, 44 and 50 (=Set_1) are equivalent patterns, since they can be derived from each other by rotation of digits (bit rotation). Same is true for 38, 41 and 52 (=Set_2). These two sets reflect reverse (mirror inverted) patterns. Each of those numbers from these sets can be viewed as a substitute to represent minimal symmetry.
For a given number b>3 the number of contiguous palindromic bit patterns in its binary representation is minimal if and only if there exists a number c from Set_1 or Set_2 such that the bit pattern of b is contained in concatenated c bit patterns, or, what is equivalent, if and only if b is contained in the concatenated bit patterns of 37 or 41.
If b is a number with more than 4 binary digits such that the number of contiguous palindromic bit patterns in its binary representation is minimal, then b is contained in the concatenated bit patterns either of 37 or 41, but not in both.
LINKS
FORMULA
a(n) = min(k > a(n-1) | A206925(k) = A206925(a(n-1))), if this minimum exists, else a(n) = min(k >= 2*2^floor(log(a(n-1))) | A206925(k) = min(A206925(j) | j >= 2*2^floor(log(a(n-1)))).
A206925(a(n)) = 2*floor(log_2(a(n))).
A070939(a(n)) = 4 + floor((n-4)/6), for n>4.
A206925(a(n)) = 6 + 2*floor((n-4)/6), for n>4.
Iteration formulas for k>0:
a(6(k+1)+4) = 2a(6k+4) + floor(37*2^(k+5)/63) mod 2.
a(6(k+1)+5) = 2a(6k+5) + floor(41*2^(k+1)/63) mod 2.
a(6(k+1)+6) = 2a(6k+6) + floor(41*2^(k+5)/63) mod 2.
a(6(k+1)+7) = 2a(6k+7) + floor(37*2^(k+2)/63) mod 2.
a(6(k+1)+8) = 2a(6k+8) + floor(37*2^(k+4)/63) mod 2.
a(6(k+1)+9) = 2a(6k+9) + floor(41*2^(k+4)/63) mod 2.
Calculation formulas for k>0:
a(6k+4) = floor((37*2^(k+4)/63) mod 2^(k+4).
a(6k+5) = floor((41*2^(k+6)/63) mod 2^(k+4).
a(6k+6) = floor((41*2^(k+4)/63) mod 2^(k+4).
a(6k+7) = floor((37*2^(k+7)/63) mod 2^(k+4).
a(6k+8) = floor((37*2^(k+9)/63) mod 2^(k+4).
a(6k+9) = floor((41*2^(k+9)/63) mod 2^(k+4).
With q(i) = 1 - 2*(floor((i+5)/6) - floor((i+4)/6) + floor((i+2)/6) + floor(i/6)),
this means q(i) = -1, 1, 1, -1, -1, 1, for i = 1..6,
p(i) = - 4 + 9*floor((i+5)/6) - 4*floor((i+4)/6) + 4*floor((i+3)/6) - 3*floor((i+2)/6)) + 2*floor((i+1)/6)),
this means p(i) = 5, 1, 5, 2, 4, 4, for i = 1..6,
k := k(n) = floor((n-4)/6),
j := j(n) = 1 + (n-4) mod 6,
we get the following formulas:
a(n+6) = 2*a(n) + floor((39+2*q(j))*2^(k+p(j))/63) mod 2, for n>9.
a(n+6) = 2*a(n) + b(k(n),j(n)), for n>9,
where b(k,j) is the 6x6-matrix:
(1 0 1 0 0 0)
(1 1 1 1 1 1)
(0 0 0 0 1 1)
(0 0 1 1 0 0)
(1 1 0 0 1 0)
(1 0 1 0 0 0).
a(n) = floor((39+2*q(j(n)))*2^(k(n)+p(j(n))+5)/63) mod 2^(k(n)+4), for n>4.
a(n) = (floor((39+2*q(j))*2^(6+p(j))/63) mod 32) * 2^(k-1) + (floor((39+2*q(j))*2^(6+p(j))/63) mod 64) * 2^(k mod 6 -1)*(2^(6*floor(k/6)) - 1)/63 + sum_{i=1..(k mod 6 - 1)} 2^(k mod 6 - 1 - i)*(floor((39+2*q(j))*2^(p(j)+i)/63) mod 2), for n>9.
a(n) = floor((39+2*q(j(n)))*2^(p(j(n))+floor((n+26)/6))/63) mod 2^floor((n+20)/6)), for n>4.
With: b(i) = floor((39+2*q(i))*2^(6+p(i))/63) mod 32, this means b(i) = 18, 19, 20, 22, 25, 26, for i = 1..6,
c(i) = (floor((39+2*q(i))*2^(6+p(i))/63) mod 64. This means c(i) = 50, 19, 52, 22, 25, 26, for i = 1..6:
a(n) = b(j)* 2^(k-1) + c(j)*2^(k mod 6 -1)*(2^(6*floor(k/6)) - 1)/63 + sum_{i=1..(k mod 6 - 1)} 2^(k mod 6 - 1 - i)*(floor(c(j)*2^i/63) mod 2), for n>9.
a(n) = floor(16*c(j)*2^floor((n+2)/6)/63) mod (8*2^floor((n+2)/6))), for n>4.
Asymptotic behavior:
a(n) = O(2^(n/6)).
lim inf a(n)/2^floor((n+2)/6) = 8*37/63 = 4.698412….
lim sup a(n)/2^floor((n+2)/6) = 8*52/63 = 6.603174….
lim inf a(n)/2^(n/6) = sqrt(2)*4*52/63 = 4.66914953….
lim sup a(n)/2^(n/6) = 2^(1/3)*8*37/63 = 5.91962906….
G.f. g(x) = x*(2 + 4x + 5x^2 + 6x^3 + 9x^4 + 10x^5 + 7x^6 + 3x^8 + 6x^9 + x^10 + x^13)/(1-2x^6) + (x^16*(1+x^2)(1+x^27) + x^22*(1-x^6)/(1-x) + x^32*(1-x^12)/((1-x^2)(1-x)) + x^47*(1+x^3)/(1-x))/(1-x^36).
Also: g(x) = x*(2 + 5x*(1-x^40) + 4x^2*(1+x^2+x^3-x^6-x^36-x^38-x^42)+ 2x^3*(1-x^3+x^6-x^7+x^39+x^43) - 6x^7*(1+x^4+x^38-x^40) - x^12*(1-x+x^7-x^8-x^10+x^15+x^16+x^18-x^20-x^23-x^24) - 3x^37*(1-x^6))/((1-x)(1+x^2)(1-x^9)(1+x^9)(1+x^18)).
EXAMPLE
a(2)=4=100_2 has 4 [=A206925(4)] contiguous palindromic bit patterns, this is the minimum value for binary numbers with 3 places. The other numbers with 3 places which meet that minimum value of 4 are 5 and 6.
a(7)=11=1011_2 has 6 [=A206925(11)] contiguous palindromic bit patterns, this is the minimum value for binary numbers with 4 places. The other numbers with 4 places which meet that minimum value of 6 are 9, 10, 12 and 13.
Examples to demonstrate the concatenation rule:
a(4) = 6 = 110_2 = (110010_2 truncated to 3 digits) = (50 truncated to 3 binary digits).
a(35) = 308 = 100110100_2 = (concatenation(100110, 100110) truncated to 9 digits) = (concatenation(38, 38) truncated to 9 binary digits).
a(94) = 307915 = 1001011001011001011_2 = (concatenation(101001, 101001, 101001, 101001) truncated to 19 digits) = (concatenation(41, 41, 41, 41) truncated to 19 binary digits).
PROG
(Smalltalk)
"Calculates a(n)"
| k j p q pArray qArray B n s |
n := self.
pArray := #(5 1 5 2 4 4).
qArray := #(-1 1 1 -1 -1 1).
B := #(2 4 5 6 9 10 11 12 13 18 19 20 22 25 26).
n < 10 ifTrue: [^s := B at: n].
k := (n - 4) // 6.
j := (n - 4) \\ 6 + 1.
p := pArray at: j.
q := qArray at: j.
s := (2 * q + 39) * (2 raisedToInteger: k + p + 5) // 63 \\ (2 raisedToInteger: k + 4).
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Mar 24 2012; additional comments and formulas Jan 23 2013
STATUS
approved
Minimal number such that the number of contiguous palindromic bit patterns in its binary representation is n, or 0, if there is no such number.
+10
4
1, 2, 3, 4, 0, 7, 8, 18, 17, 15, 16, 42, 33, 68, 31, 32, 133, 65, 267, 130, 63, 64, 260, 129, 341, 258, 447, 127, 128, 682, 257, 1040, 514, 895, 1029, 255, 256, 1919, 513, 2056, 1026, 1791, 2053, 2052, 511, 512, 5376, 1025, 5461, 2050, 3583, 4101, 4100, 8203, 1023, 1024, 8200
OFFSET
1,2
COMMENTS
The set of numbers which have n contiguous palindromic bit patterns (in their binary representation) is not empty, provided n<>5. Proof: For even n we have A206925(A206927(n/2)) = 2*(n/2) = n. For n=1,3,7,9 we get A206925(k)=n if we set k=1,3,8,17. For odd n>10 we define b(n) := 14*2^((n-9)/2)+A206927((n-9)/2). The b(n) have the binary expansion 11110, 111100, 1111001, 11110010, 111100101, 1111001011, 11110010110, 111100101100, 1111001011001, 11110010110010, 111100101100101, ..., for n=11, 13, 15, 17, ... . Evidently, b(n) is constructed by the concatenation of 111 with repeated bit patterns of 100101 (=37) truncated to 4+(n-9)/2 digits. As a result, the number of contiguous palindromic bit patterns of b(n) is A206925(111_2) + 3 + A206925(A206927((n-9)/2)) = 6 + 3 + n - 9 = n. This proves that there is always a number with n contiguous palindromic bit patterns.
a(5)=0, and this is the only zero term. Proof: The inequality A206925(n) >= 2*floor(log_2(n)) (cf. A206925) implies A206925(n) > 5 for n >= 8. By direct search we find A206925(n)<>5 for n=1..7. Thus, there is no k with A206925(k)=5, which implies a(5)=0.
LINKS
FORMULA
a(n) = min(k | A206925(k) = n), for n<>5.
A206925(a(n)) = n, n<>5.
a(n) <= A217100(n), equality holds for n = 1, 2, 3 and 5, only.
a(A000217(n)) = 2^n - 1.
a(A000217(n)+1) = 2^n.
a(A000217(n)+3) = 2^(n+1)+1, n>2.
a(A000217(n)+5) = 2^(n+2)+2, n>4.
a(A000217(n)+6) = 2^(n+3) - 2^n - 1, n>5.
a(A000217(n)+7) = 2^(n+3)+5, n>6.
a(A000217(n)+8) = 2^(n+3)+4, n>7.
a(A000217(n)+9) = 2^(n+4)+11, n>8.
a(A000217(n)+10) = 2^(n+4) - 2^n - 1, n>9.
a(A000217(n)+11) = 21*2^n, n>10.
a(A000217(n)+12) = 2^(n+4)+8, n>11.
a(A000217(n)+13) = 2^(n+5)+18, n>12.
EXAMPLE
a(3) = 3, since 3=11_2 has 3 contiguous palindromic bit patterns, and this is the least such number.
a(6) = 7. Since 7=111_2 has 6 contiguous palindromic bit patterns, and this is the least such number.
a(8) = 18. Since 18=10010_2 has 8 contiguous palindromic bit patterns (1, 0, 0, 1, 0, 00, 010 and 1001), and this is the least such number.
a(9) = 17. Since 17=10001_2 has 9 contiguous palindromic bit patterns (1, 0, 0, 0, 1, 00, 00, 000, and 10001), and this is the least such number.
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Jan 23 2013
STATUS
approved

Search completed in 0.010 seconds