A376423 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.
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, 41, 42, 43, 44, 45, 46, 49, 50, 53, 54, 58, 68, 69, 70, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 98, 101, 102, 105, 106, 109
Offset: 1
Examples
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.
Links
Programs
-
PARI
toruns(n) = { my (r = []); while (n, my (v = valuation(n+n%2, 2)); n \= 2^v; r = concat(v, r)); r } is(n) = { my (r = toruns(n)); #setbinop((i, j) -> vecsum(r[i..j]), [1..#r])==vecsum(r); }
Comments