%I #12 Aug 26 2019 15:53:39
%S 0,1,1,1,1,1,2,3,1,1,2,3,3,3,3,3,1,1,2,3,4,5,5,5,3,3,3,3,4,5,6,7,1,1,
%T 2,3,4,5,6,7,5,5,5,5,5,5,6,7,3,3,3,3,4,5,6,7,7,7,7,7,7,7,7,7,1,1,2,3,
%U 4,5,6,7,8,9,9,9,9,9,9,9,5,5,5,5,5,5,6
%N For any n >= 0: consider the different ways to split the binary representation of n into two (possibly empty) parts, say with value x and y; a(n) is the least possible value of max(x, y).
%H Rémy Sigrist, <a href="/A327192/b327192.txt">Table of n, a(n) for n = 0..8192</a>
%F a(n) = 1 iff n = 2^k or n = 2^k + 1 for some k >= 0.
%e For n=42:
%e - the binary representation of 42 is "101010",
%e - there are 7 ways to split it:
%e - "" and "101010": x=0 and y=42: max(0, 42) = 42,
%e - "1" and "01010": x=1 and y=10: max(1, 10) = 10,
%e - "10" and "1010": x=2 and y=10: max(2, 10) = 10,
%e - "101" and "010": x=5 and y=2: max(5, 2) = 5,
%e - "1010" and "10": x=10 and y=2: max(10, 2) = 10,
%e - "10101" and "0": x=21 and y=0: max(21, 0) = 21,
%e - "101010" and "": x=42 and y=0: max(42, 0) = 42,
%e - hence a(42) = 5.
%o (PARI) a(n) = my (v=oo, b=binary(n)); for (w=0, #b, v=min(v, max(fromdigits(b[1..w],2), fromdigits(b[w+1..#b],2)))); v
%Y See A327186 for other variants.
%K nonn,look,base
%O 0,7
%A _Rémy Sigrist_, Aug 25 2019
|