OFFSET
0,3
COMMENTS
In other words, the n-th row contains the numbers k with the same binary length as n and for any i >= 0, if the i-th bit and the (i+1)-th bit in k are different then they are also different in n (i = 0 corresponding to the least significant bit).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..9841 (rows for n = 0..511 flattened)
EXAMPLE
Triangle begins (in decimal and in binary):
n n-th row bin(n) n-th row in binary
-- ------------ ------ ------------------
0 0 0 0
1 1 1 1
2 2, 3 10 10, 11
3 3 11 11
4 4, 7 100 100, 111
5 4, 5, 6, 7 101 100, 101, 110, 111
6 6, 7 110 110, 111
7 7 111 111
8 8, 15 1000 1000, 1111
9 8, 9, 14, 15 1001 1000, 1001, 1110, 1111
.
For n = 9:
- the binary expansion of 9 is "1001",
- the corresponding run lengths are 1, 2, 1,
- so the 9th row contains the values with the following run lengths:
1, 2, 1 -> 9 ("1001" in binary)
1, 2+1 -> 8 ("1000" in binary)
1+2, 1 -> 14 ("1110" in binary)
1+2+1 -> 15 ("1111" in binary)
PROG
(PARI) row(n) = { my (r = []); while (n, my (v = valuation(n+n%2, 2)); n \= 2^v; r = concat(v, r)); my (s = [if (#r, 2^r[1]-1, 0)]); for (k = 2, #r, s = concat(s * 2^r[k], [(h+1)*2^r[k]-1|h<-s]); ); vecsort(s); }
CROSSREFS
KEYWORD
nonn,base,tabf
AUTHOR
Rémy Sigrist, Mar 19 2023
STATUS
approved