A327961 Sum of products of n-bit numbers with their n-bit reverse.
0, 1, 13, 122, 1028, 8328, 66576, 530464, 4227136, 33718400, 269222144, 2151154176, 17196647424, 137514452992, 1099847176192, 8797569425408, 70375186644992, 562977870741504, 4503719886520320, 36029312415170560, 288232575175229440, 2305852355063054336
Offset: 0
Links
- Colin Barker, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (18,-112,288,-256).
Programs
-
Mathematica
CoefficientList[Series[x (1 - 5 x)/((1 - 2 x) (1 - 4 x)^2*(1 - 8 x)), {x, 0, 21}], x] (* Michael De Vlieger, Oct 01 2019 *)
-
PARI
f(n) = (fromdigits(Vecrev(binary(n)), 2) - 1)/2; \\ A030109 a(n) = sum(k=0, 2^n, f(2^n+k)*k); \\ Michel Marcus, Oct 01 2019
-
PARI
concat(0, Vec(x*(1 - 5*x) / ((1 - 2*x)*(1 - 4*x)^2*(1 - 8*x)) + O(x^25))) \\ Colin Barker, Oct 01 2019
-
Python
revbits = lambda i, n: int(bin(i)[2:].rjust(n, '0')[::-1], 2) def a(n): return sum(i * revbits(i, n) for i in range(2**n)) print([a(n) for n in range(22)])
Formula
a(n) = Sum_{k=0..2^n-1} k * A030109(2^n+k).
a(n+1) = 4*a(n) + 2^(3n) + 2^(2n-1) - 2^(n-1).
a(n) = n*2^(2*n-3) + 2^(3n-2) + 2^(n-2) - 2^(2n-1).
From Colin Barker, Oct 01 2019: (Start)
G.f.: x*(1 - 5*x) / ((1 - 2*x)*(1 - 4*x)^2*(1 - 8*x)).
a(n) = 2^(n-3) * (2*(2^n-1)^2 + 2^n*n).
a(n) = 18*a(n-1) - 112*a(n-2) + 288*a(n-3) - 256*a(n-4) for n>3.
(End)
E.g.f.: (1/4)*(exp(2*x) + exp(8*x) + 2*exp(4*x)*(-1 + x)). - Stefano Spezia, Oct 01 2019
Comments