login
For any n >= 0: consider all pairs of numbers (x, y) whose binary representations can be interleaved (or shuffled) to produce the binary representation of n (possibly with leading zeros); a(n) is the least possible value of abs(x - y).
2

%I #7 Jan 05 2020 12:58:26

%S 0,1,1,0,1,0,1,2,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,2,1,1,0,1,2,3,4,1,0,

%T 0,1,0,1,1,0,0,1,1,0,1,0,1,2,0,1,1,0,1,0,0,1,2,1,0,1,0,1,1,0,1,0,0,1,

%U 0,1,1,0,0,1,1,0,1,0,1,2,0,1,1,0,1,0,0

%N For any n >= 0: consider all pairs of numbers (x, y) whose binary representations can be interleaved (or shuffled) to produce the binary representation of n (possibly with leading zeros); a(n) is the least possible value of abs(x - y).

%H Rémy Sigrist, <a href="/A330961/a330961.txt">C program for A330961</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%e For n = 5:

%e - the binary representation of 5 is "101",

%e - the possible values for (x, y), restricted to x >= y without loss of generality, are:

%e bin(5) x y |x-y|

%e ------- - - -----

%e "101" 5 0 5

%e "1/01" 1 1 0

%e "10/1" 2 1 1

%e "1/0/1" 3 0 3

%e - hence a(5) = 0.

%o (C) See Links section.

%Y See A330925 for similar sequences.

%Y Cf. A327191.

%K nonn,base

%O 0,8

%A _Rémy Sigrist_, Jan 04 2020