login
A352579
Irregular triangle T(n,k) (n >= 1, 0 <= k <= 2^n-2) read by rows: row n = 1 is [0]; thereafter, T(n,k) = 2*T(n-1,k)+(k mod 2) and T(n,k+2^(n-1)-1) = 2*T(n-1,k)+(k+1 mod 2) for k = 0..2^(n-1)-2; T(n,2^n-2) = 2^n-2.
1
0, 0, 1, 2, 0, 3, 4, 1, 2, 5, 6, 0, 7, 8, 3, 4, 11, 12, 1, 6, 9, 2, 5, 10, 13, 14, 0, 15, 16, 7, 8, 23, 24, 3, 12, 19, 4, 11, 20, 27, 28, 1, 14, 17, 6, 9, 22, 25, 2, 13, 18, 5, 10, 21, 26, 29, 30, 0, 31, 32, 15, 16, 47, 48, 7, 24, 39, 8, 23, 40, 55, 56, 3, 28, 35, 12, 19, 44, 51, 4, 27, 36, 11, 20, 43, 52, 59, 60, 1, 30, 33, 14, 17, 46, 49, 6, 25, 38, 9, 22, 41, 54, 57, 2, 29, 34, 13, 18, 45, 50, 5, 26, 37, 10, 21, 42, 53, 58, 61, 62
OFFSET
1,4
COMMENTS
The n-th row lists the numbers from 0 to 2^n-2 in such a way that the binary expansions of adjacent terms are disjoint.
Inspired by A109812.
LINKS
N. J. A. Sloane, Row 14 in full: 16383 terms. The numbers from 0 to 2^14-2 arranged so that adjacent terms have disjoint binary expansions. [Note this is not a b-file]
EXAMPLE
The initial rows are:
[0]
[0, 1, 2]
[0, 3, 4, 1, 2, 5, 6]
[0, 7, 8, 3, 4, 11, 12, 1, 6, 9, 2, 5, 10, 13, 14]
[0, 15, 16, 7, 8, 23, 24, 3, 12, 19, 4, 11, 20, 27, 28, 1, 14, 17, 6, 9, 22, 25, 2, 13, 18, 5, 10, 21, 26, 29, 30]
...
MAPLE
T:=proc(n) option remember; local t1, t2, k;
if n=1 then [0];
else
t1:=[seq(2*T(n-1)[k+1] + (k mod 2), k=0..2^(n-1)-2 )];
t2:=[seq(2*T(n-1)[k+1] + (k+1 mod 2), k=0..2^(n-1)-2 )];
[op(t1), op(t2), 2^n-2];
fi;
end;
[seq(T(n), n=1..8)];
MATHEMATICA
T[n_] := T[n] = Module[{t1, t2, k},
If[n == 1, {0},
t1 = Table[2*T[n-1][[k+1]] + Mod[k, 2], {k, 0, 2^(n-1)-2}];
t2 = Table[2*T[n-1][[k+1]] + Mod[k+1, 2], {k, 0, 2^(n-1)-2}];
{t1, t2, 2^n-2} // Flatten]];
Table[T[n], {n, 1, 8}] // Flatten (* Jean-François Alcover, Jul 07 2022, after Maple code *)
CROSSREFS
Cf. A109812.
Sequence in context: A137372 A212844 A066439 * A241319 A287016 A368312
KEYWORD
nonn,tabf
AUTHOR
N. J. A. Sloane, Apr 08 2022
STATUS
approved