login
Nonnegative numbers m such that the run lengths in binary expansion of m, say (r_1, ..., r_k), correspond to a complete ruler: the sums r_i + ... r_j with i <= j <= k cover an initial interval of the positive integers.
2

%I #7 Sep 25 2024 10:28:59

%S 0,1,2,4,5,6,9,10,11,13,18,19,20,21,22,23,25,26,29,34,35,36,37,38,40,

%T 41,42,43,44,45,46,49,50,53,54,58,68,69,70,73,74,75,76,77,78,80,81,82,

%U 83,84,85,86,87,88,89,90,91,92,93,98,101,102,105,106,109

%N Nonnegative numbers m such that the run lengths in binary expansion of m, say (r_1, ..., r_k), correspond to a complete ruler: the sums r_i + ... r_j with i <= j <= k cover an initial interval of the positive integers.

%C There are A103295(k) terms with k binary digits (ignoring leading zeros).

%H Rémy Sigrist, <a href="/A376423/b376423.txt">Table of n, a(n) for n = 1..10000</a>

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

%e The binary expansion of 35 is "100011", the corresponding run lengths are (1, 3, 2); the sums 1, 2, 3, 1+3, 3+2, 1+3+2 cover the positive integers between 1 and 6, hence 35 is a term.

%o (PARI) toruns(n) = { my (r = []); while (n, my (v = valuation(n+n%2, 2)); n \= 2^v; r = concat(v, r)); r }

%o is(n) = { my (r = toruns(n)); #setbinop((i, j) -> vecsum(r[i..j]), [1..#r])==vecsum(r); }

%Y Cf. A101211, A103295, A376314.

%K nonn,base

%O 1,3

%A _Rémy Sigrist_, Sep 22 2024