[go: up one dir, main page]

login
minflip(n) = min(n, r(n)) where r(n) is the binary reverse of n.
2

%I #23 May 05 2019 10:08:06

%S 0,1,1,3,1,5,3,7,1,9,5,11,3,11,7,15,1,17,9,19,5,21,13,23,3,19,11,27,7,

%T 23,15,31,1,33,17,35,9,37,25,39,5,37,21,43,13,45,29,47,3,35,19,51,11,

%U 43,27,55,7,39,23,55,15,47,31,63

%N minflip(n) = min(n, r(n)) where r(n) is the binary reverse of n.

%H Francois Alcover, <a href="/A325401/b325401.txt">Table of n, a(n) for n = 0..16384</a>

%F a(n) = min(n,A030101(n)).

%e a(2) = min(2, r(2))

%e = min(2, b'01')

%e = min(2,1)

%e = 1.

%p a:= proc(n) local m, r; m:=n; r:=0;

%p while m>0 do r:=r*2+irem(m, 2, 'm') od;

%p min(n, r)

%p end:

%p seq(a(n), n=0..127); # _Alois P. Heinz_, Apr 23 2019

%o (PARI) a(n) = min(n, fromdigits(Vecrev(binary(n)), 2)); \\ _Michel Marcus_, Apr 23 2019

%Y Cf. A030101, A325402.

%Y Cf. A068636 (analog in base 10).

%K nonn,look,base

%O 0,4

%A _Francois Alcover_, Apr 23 2019