login
A368509
Irregular triangle read by rows. A variation on the inventory sequence A342585. See Comments and Example sections for details.
1
0, 1, 1, 1, 2, 2, 1, 2, 0, 0, 2, 3, 2, 3, 2, 5, 1, 2, 0, 0, 3, 5, 3, 4, 2, 6, 2, 4, 1, 2, 2, 2, 1, 1, 0, 0, 4, 7, 4, 7, 3, 10, 3, 6, 2, 4, 2, 2, 2, 2, 1, 2, 0, 0, 5, 9, 5, 8, 4, 14, 3, 6, 3, 6, 3, 4, 3, 3, 1, 2, 1, 1, 1, 1, 1, 1, 0, 0, 6, 11, 6, 14, 5, 14, 4, 10, 4, 9, 4, 5
OFFSET
1,5
COMMENTS
Build an irregular triangle in a slightly similar manner to A342585:
Here, record the number of rows containing zeros thus far in the irregular triangle, then the number of columns containing zeros thus far, then the number of rows containing ones thus far, then again the number of columns with ones and so on alternately counts of rows and of columns, until a completed row-column value pair is recorded with either being zero; a new row of the triangle then starts again, recording the number of rows having any zero in them, then the number of columns, and so on. The sequence is the triangle read by rows.
LINKS
EXAMPLE
The irregular triangle begins:
0, 1;
1, 1, 2, 2, 1, 2, 0, 0;
2, 3, 2, 3, 2, 5, 1, 2, 0, 0;
3, 5, 3, 4, 2, 6, 2, 4, 1, 2, 2, 2, 1, 1, 0, 0;
4, 7, 4, 7, 3, 10, 3, 6, 2, 4, 2, 2, 2, 2, 1, 2, 0, 0;
...
PROG
(Python)
from itertools import islice
from collections import Counter
def agen(): # generator of terms
rowinventory, colinventory, thisrow, m = Counter(), dict(), set(), 0
while True:
rc = rowinventory[m]
yield rc
if rc not in thisrow: rowinventory[rc] += 1; thisrow.add(rc)
if rc not in colinventory: colinventory[rc] = {2*m}
else: colinventory[rc].add(2*m)
cc = len(colinventory.get(m, set()))
yield cc
if cc not in thisrow: rowinventory[cc] += 1; thisrow.add(cc)
if cc not in colinventory: colinventory[cc] = {2*m+1}
else: colinventory[cc].add(2*m+1)
if rc == 0 or cc == 0: m = 0; thisrow = set()
else: m += 1
print(list(islice(agen(), 90))) # Michael S. Branicky, Dec 28 2023
CROSSREFS
Cf. A342585.
Sequence in context: A208929 A039965 A300481 * A074942 A043754 A144191
KEYWORD
nonn,tabf
AUTHOR
Tamas Sandor Nagy, Dec 28 2023
STATUS
approved