cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A327961 Sum of products of n-bit numbers with their n-bit reverse.

This page as a plain text file.
%I A327961 #30 Oct 03 2019 08:39:00
%S A327961 0,1,13,122,1028,8328,66576,530464,4227136,33718400,269222144,
%T A327961 2151154176,17196647424,137514452992,1099847176192,8797569425408,
%U A327961 70375186644992,562977870741504,4503719886520320,36029312415170560,288232575175229440,2305852355063054336
%N A327961 Sum of products of n-bit numbers with their n-bit reverse.
%C A327961 For each n, let k go from 0 to 2^n-1. Write each k in binary using n bits, reverse the bits, then multiply by k. a(n) is the sum of these products.
%C A327961 For example, when n = 2, the 2-bit strings are 00, 01, 10, and 11 (in decimal: 0,1,2,3). When they are bit-reversed, we get 00, 10, 01, and 11 (in decimal: 0,2,1,3). Multiplying and adding the corresponding pairs, we get a(2) = 0*0 + 1*2 + 2*1 + 3*3 = 13.
%H A327961 Colin Barker, <a href="/A327961/b327961.txt">Table of n, a(n) for n = 0..1000</a>
%H A327961 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (18,-112,288,-256).
%F A327961 a(n) = Sum_{k=0..2^n-1} k * A030109(2^n+k).
%F A327961 a(n+1) = 4*a(n) + 2^(3n) + 2^(2n-1) - 2^(n-1).
%F A327961 a(n) = n*2^(2*n-3) + 2^(3n-2) + 2^(n-2) - 2^(2n-1).
%F A327961 From _Colin Barker_, Oct 01 2019: (Start)
%F A327961 G.f.: x*(1 - 5*x) / ((1 - 2*x)*(1 - 4*x)^2*(1 - 8*x)).
%F A327961 a(n) = 2^(n-3) * (2*(2^n-1)^2 + 2^n*n).
%F A327961 a(n) = 18*a(n-1) - 112*a(n-2) + 288*a(n-3) - 256*a(n-4) for n>3.
%F A327961 (End)
%F A327961 E.g.f.: (1/4)*(exp(2*x) + exp(8*x) + 2*exp(4*x)*(-1 + x)). - _Stefano Spezia_, Oct 01 2019
%t A327961 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 *)
%o A327961 (Python)
%o A327961 revbits = lambda i, n: int(bin(i)[2:].rjust(n, '0')[::-1], 2)
%o A327961 def a(n):
%o A327961   return sum(i * revbits(i, n) for i in range(2**n))
%o A327961 print([a(n) for n in range(22)])
%o A327961 (PARI) f(n) = (fromdigits(Vecrev(binary(n)), 2) - 1)/2; \\ A030109
%o A327961 a(n) = sum(k=0, 2^n, f(2^n+k)*k); \\ _Michel Marcus_, Oct 01 2019
%o A327961 (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
%Y A327961 Cf. A030101, A030109, A049773.
%K A327961 nonn,base,easy
%O A327961 0,3
%A A327961 _Peter Ward_, Sep 30 2019