%I #15 Sep 02 2018 13:37:04
%S 0,1,0,1,-2,-1,-2,-1,0,1,0,1,-2,-1,-2,-1,4,5,4,5,2,3,2,3,4,5,4,5,2,3,
%T 2,3,0,1,0,1,-2,-1,-2,-1,0,1,0,1,-2,-1,-2,-1,4,5,4,5,2,3,2,3,4,5,4,5,
%U 2,3,2,3,-8,-7,-8,-7,-10,-9,-10,-9,-8,-7,-8,-7
%N For any n >= 0 with binary expansion Sum_{k=0..w} b_k * 2^k, let f(n) = Sum_{k=0..w} b_k * i^k * 2^floor(k/2) (where i denotes the imaginary unit); a(n) is the real part of f(n).
%C See A318703 for the imaginary part of f.
%C See A318704 for the square of the modulus of f.
%C The function f defines a bijection from the nonnegative integers to the Gaussian integers.
%C This sequence has similarities with A316657.
%H Rémy Sigrist, <a href="/A318702/b318702.txt">Table of n, a(n) for n = 0..16383</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H Rémy Sigrist, <a href="/A318702/a318702.png">Colored scatterplot of (a(n), A318703(n)) for n = 0..2^19-1</a> (where the hue is function of n)
%F a(n) = A053985(A059905(n)).
%F a(4 * k) = -2 * a(k) for any k >= 0.
%t Array[Re[Total@ MapIndexed[#1*I^(First@ #2 - 1)*2^Floor[(First@ #2 - 1)/2] &, Reverse@ IntegerDigits[#, 2]]] &, 76, 0] (* _Michael De Vlieger_, Sep 02 2018 *)
%o (PARI) a(n) = my (b=Vecrev(binary(n))); real(sum(k=1, #b, b[k] * I^(k-1) * 2^floor((k-1)/2)))
%Y Cf. A053985, A059905, A316657, A318703, A318704.
%K sign,base
%O 0,5
%A _Rémy Sigrist_, Sep 01 2018
|