|
|
A362240
|
|
Triangle read by rows: Row n is the shortest, then lexicographically earliest sequence of 0s and 1s not yet in the sequence.
|
|
6
|
|
|
0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1
|
|
COMMENTS
|
Shortest then lexicographically earliest ordering for rows is as in A076478.
|
|
LINKS
|
|
|
EXAMPLE
|
The triangle begins:
n row(n)
--- ------
1 0;
2 1;
3 0, 0;
4 1, 1;
5 0, 0, 0;
6 1, 0, 1;
7 1, 1, 1;
8 0, 0, 0, 0;
9 1, 0, 1, 0;
10 1, 1, 0, 1;
11 0, 0, 0, 0, 0;
12 0, 0, 0, 1, 1;
13 0, 0, 1, 0, 0;
For row 6, we know that all binary sequences up to row 5 = {0, 0, 0} appear, so we first check {0, 0, 1}. This sequence appears at {a(3), a(4), a(5)} (using parts of rows 3 and 4).
Next, check {0, 1, 0}. This sequence appears at {a(1), a(2), a(3)} (using parts of rows 1, 2, and 3).
Next, check {0, 1, 1}. This sequence appears at {a(4), a(5), a(6)} (using parts of rows 3 and 4).
Next, check {1, 0, 0}. This sequence appears at {a(2), a(3), a(4)} (using parts of rows 2 and 3).
Next, check {1, 0, 1}. This sequence does not appear anywhere in the sequence, so row 6 of the triangle is {1, 0, 1}.
|
|
MATHEMATICA
|
V = {0}; K = {0}; While[Length@K <= 87, y = 0; While[y == 0, i = Length@V; V[[i]]++; While[V[[i]] == 2 && i > 1 , V[[i]] = 0; i--; V[[i]]++]; If[V[[1]] == 2, V = ConstantArray[0, Length@V + 1]]; z = 0; For[a = 1, a <= Length@K - Length@V + 1, a++, If[K[[a ;; a + Length@V - 1]] == V, z = 1; Break[]]]; If[z == 0, AppendTo[K, V]; K = Flatten[K]; y = 1]]]; Print[K[[1 ;; 87]]]
|
|
PROG
|
(MATLAB) See Links section.
(Python)
from itertools import chain, count, islice, product
def bins(): yield from ("".join(b) for d in count(1) for b in product("01", repeat=d))
def agen(s=""): yield from chain.from_iterable(map(int, t) for t in bins() if t not in s and (s:=s+t))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,tabf
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|