OFFSET
1,3
COMMENTS
Different from A206919.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Feb 18 2012
STATUS
approved