cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A327191 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 abs(x - y).

This page as a plain text file.
%I A327191 #12 Aug 26 2019 15:54:15
%S A327191 0,1,1,0,1,0,1,2,1,0,0,1,3,2,1,0,1,0,0,1,2,3,3,2,3,2,1,0,1,2,3,4,1,0,
%T A327191 0,1,0,1,2,3,5,4,3,2,1,0,1,2,3,2,1,0,1,1,0,1,5,6,5,4,3,2,1,0,1,0,0,1,
%U A327191 0,1,2,1,4,5,6,6,5,4,3,2,5,4,3,2,1,0,1
%N A327191 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 abs(x - y).
%H A327191 Rémy Sigrist, <a href="/A327191/b327191.txt">Table of n, a(n) for n = 0..8192</a>
%F A327191 a(n) = 0 iff n = 0 or n belongs to A175468.
%e A327191 For n=42:
%e A327191 - the binary representation of 42 is "101010",
%e A327191 - there are 7 ways to split it:
%e A327191    - "" and "101010": x=0 and y=42: abs(0 - 42) = 42,
%e A327191    - "1" and "01010": x=1 and y=10: abs(1 - 10) = 9,
%e A327191    - "10" and "1010": x=2 and y=10: abs(2 - 10) = 8,
%e A327191    - "101" and "010": x=5 and y=2: abs(5 - 2) = 3,
%e A327191    - "1010" and "10": x=10 and y=2: abs(10 - 2) = 8,
%e A327191    - "10101" and "0": x=21 and y=0: abs(21 - 0) = 21,
%e A327191    - "101010" and "": x=42 and y=0: abs(42 - 0) = 42,
%e A327191 - hence a(42) = 3.
%o A327191 (PARI) a(n) = my (v=oo, b=binary(n)); for (w=0, #b, v=min(v, abs(fromdigits(b[1..w],2) - fromdigits(b[w+1..#b],2)))); v
%Y A327191 See A327186 for other variants.
%Y A327191 Cf. A175468.
%K A327191 nonn,look,base
%O A327191 0,8
%A A327191 _Rémy Sigrist_, Aug 25 2019