# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a327186 Showing 1-1 of 1 %I A327186 #13 Aug 26 2019 16:31:37 %S A327186 0,1,1,1,1,1,3,3,1,1,2,3,3,3,3,3,1,1,2,3,5,5,6,7,3,3,3,3,7,7,7,7,1,1, %T A327186 2,3,4,5,6,7,5,5,7,7,5,5,7,7,3,3,3,3,6,7,6,7,7,7,7,7,7,7,7,7,1,1,2,3, %U A327186 4,5,6,7,9,9,10,11,12,13,14,15,5,5,7,7,5 %N A327186 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 x OR y (where OR denotes the bitwise OR operator). %H A327186 Rémy Sigrist, Table of n, a(n) for n = 0..8192 %F A327186 a(n) = 1 iff n = 2^k or n = 2^k + 1 for some k >= 0. %e A327186 For n=42: %e A327186 - the binary representation of 42 is "101010", %e A327186 - there are 7 ways to split it: %e A327186 - "" and "101010": x=0 and y=42: 0 OR 42 = 42, %e A327186 - "1" and "01010": x=1 and y=10: 1 OR 10 = 11, %e A327186 - "10" and "1010": x=2 and y=10: 2 OR 10 = 10, %e A327186 - "101" and "010": x=5 and y=2: 5 OR 2 = 7, %e A327186 - "1010" and "10": x=10 and y=2: 10 OR 2 = 10, %e A327186 - "10101" and "0": x=21 and y=0: 21 OR 0 = 21, %e A327186 - "101010" and "": x=42 and y=0: 42 OR 0 = 42, %e A327186 - hence a(42) = 7. %o A327186 (PARI) a(n) = my (v=oo, b=binary(n)); for (w=0, #b, v=min(v, bitor(fromdigits(b[1..w],2), fromdigits(b[w+1..#b],2)))); v %Y A327186 Cf. A327187 (x XOR y variant), A327188 (x AND y variant). %Y A327186 Cf. A327189 (x + y variant), A327190 (x * y variant), A327191 (x - y variant). %Y A327186 Cf. A327192 (max(x, y) variant), A327193 (min(x, y) variant). %Y A327186 Cf. A327194 (x^2 + y^2 variant), A327195 (x^2 - y^2 variant). %K A327186 nonn,look,base %O A327186 0,7 %A A327186 _Rémy Sigrist_, Aug 25 2019 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE