[go: up one dir, main page]

login
Search: a206918 -id:a206918
     Sort: relevance | references | number | modified | created      Format: long | short | data
Sum of binary palindromes in the half-open interval [2^(n-1), 2^n).
+0
1
0, 1, 3, 12, 24, 96, 192, 768, 1536, 6144, 12288, 49152, 98304, 393216, 786432, 3145728, 6291456, 25165824, 50331648, 201326592, 402653184, 1610612736, 3221225472, 12884901888, 25769803776, 103079215104, 206158430208, 824633720832, 1649267441664, 6597069766656
OFFSET
0,3
COMMENTS
First differences of A206918.
FORMULA
a(n) = (3/8)*2^(n+floor((n+1)/2)).
a(n) = 8*a(n-2) for n>3. G.f.: -x*(4*x^2+3*x+1) / (8*x^2-1). - Colin Barker, May 31 2013
EXAMPLE
a(0) = 0, since there is no binary palindrome 2^(-1) <= p < 2^0;
a(3) = 12, since 2^2 <= p < 2^3 for p = 5 and p = 7.
KEYWORD
nonn,base,easy
AUTHOR
Hieronymus Fischer, Feb 18 2012
EXTENSIONS
More terms from Colin Barker, May 31 2013
STATUS
approved
Sum of the first n binary palindromes; a(n) = Sum_{k=1..n} A006995(k).
+0
6
0, 1, 4, 9, 16, 25, 40, 57, 78, 105, 136, 169, 214, 265, 328, 393, 466, 551, 644, 743, 850, 969, 1096, 1225, 1378, 1543, 1732, 1927, 2146, 2377, 2632, 2889, 3162, 3459, 3772, 4097, 4438, 4803, 5184, 5571, 5974, 6401, 6844, 7299, 7770, 8265, 8776, 9289, 9850
OFFSET
1,3
COMMENTS
Different from A206919.
LINKS
FORMULA
Let n > 3, p = A006995(n), m = floor(log_2(p)), then
a(n) = (8/7)*((3/4)*(4 - (-1)^m)/(3 + (-1)^m)*2^(3*floor(m/2)) - 1) + (floor(p/2^floor(m/2)) mod 2)*p + 2^m + 1 + Sum_{k = 1..(floor(m/2) - 1)} (floor(p/2^k) mod 2)*(2^k + 2^(m-k) + 2^(m-floor(m/2) + 1)*(4^(floor(m/2) - k - 1) - 1) + (2 - (-1)^m)*2^floor(m/2) + 2^(floor(m/2) - k)*(p - floor((p mod (2^(m-k+1)))/2^k)*2^k)). - [Corrected; missing factor to the sum term (2 -(-1)^m) pasted by the author, Sep 07 2018]
From Hieronymus Fischer, Sep 07 2018: (Start)
Slightly simplified and better readable formula:
a(n) = A_m + B_m + 2^m + 1 + Sum_{k = 1..(m2-1)} C_k*(D_k + E_k + F_k + G_k),
where m2 = floor(m/2),
A_m = (8/7)*((3/4)*(4-(-1)^m)/(3+(-1)^m)*2^(3*m2)-1),
B_m = p*(floor(p/2^m2) mod 2),
C_k = floor(p/2^k) mod 2,
D_k = 2^k + 2^(m-k),
E_k = 2^(m-m2+1)*(4^(m2-k-1)-1),
F_k = (2 - (-1)^m)*2^m2,
G_k = 2^(m2-k) * (p - p mod (2^(m-k+1)) + p mod 2^k). (End)
G.f.: g(x) = (x^2 + 3x^3 + Sum_{j >= 1} (3*2^j*(1 - x^floor((j+1)/2))/(1-x)*x^((1/2) - floor((j+1)/2)) + f_j(x) - f_j(1/x))*x^(2*2^floor(j/2) + 3*2^floor((j-1)/2) - (1/2)))/(1-x), where the f_j(x) are the same as defined for the g.f. of A006995.
EXAMPLE
a(1) = 0, since A006995(1) = 0;
a(4) = 9, since the sum of the first 4 binary palindromes is 9 = 0 + 1 + 3 + 5.
MATHEMATICA
Accumulate@ Map[FromDigits[#, 2] &, Select[Array[IntegerDigits[#, 2] &, 600, 0], PalindromeQ]] (* Michael De Vlieger, Feb 20 2018 *)
PROG
(Haskell)
a206920 n = a206920_list !! (n-1)
a206920_list = scanl1 (+) a006995_list
-- Reinhard Zumkeller, Feb 27 2012
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Feb 18 2012
STATUS
approved

Search completed in 0.005 seconds