cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A368509 Irregular triangle read by rows. A variation on the inventory sequence A342585. See Comments and Example sections for details.

This page as a plain text file.
%I A368509 #15 Jan 29 2024 19:07:55
%S A368509 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,
%T A368509 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,
%U A368509 3,1,2,1,1,1,1,1,1,0,0,6,11,6,14,5,14,4,10,4,9,4,5
%N A368509 Irregular triangle read by rows. A variation on the inventory sequence A342585. See Comments and Example sections for details.
%C A368509 Build an irregular triangle in a slightly similar manner to A342585:
%C A368509 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.
%H A368509 Michael S. Branicky, <a href="/A368509/b368509.txt">Table of n, a(n) for n = 1..10000</a>
%e A368509 The irregular triangle begins:
%e A368509   0,  1;
%e A368509   1,  1,  2,  2,  1,  2,  0,  0;
%e A368509   2,  3,  2,  3,  2,  5,  1,  2,  0,  0;
%e A368509   3,  5,  3,  4,  2,  6,  2,  4,  1,  2,  2,  2,  1,  1,  0,  0;
%e A368509   4,  7,  4,  7,  3, 10,  3,  6,  2,  4,  2,  2,  2,  2,  1,  2,  0,  0;
%e A368509   ...
%o A368509 (Python)
%o A368509 from itertools import islice
%o A368509 from collections import Counter
%o A368509 def agen(): # generator of terms
%o A368509     rowinventory, colinventory, thisrow, m = Counter(), dict(), set(), 0
%o A368509     while True:
%o A368509         rc = rowinventory[m]
%o A368509         yield rc
%o A368509         if rc not in thisrow: rowinventory[rc] += 1; thisrow.add(rc)
%o A368509         if rc not in colinventory: colinventory[rc] = {2*m}
%o A368509         else: colinventory[rc].add(2*m)
%o A368509         cc = len(colinventory.get(m, set()))
%o A368509         yield cc
%o A368509         if cc not in thisrow: rowinventory[cc] += 1; thisrow.add(cc)
%o A368509         if cc not in colinventory: colinventory[cc] = {2*m+1}
%o A368509         else: colinventory[cc].add(2*m+1)
%o A368509         if rc == 0 or cc == 0: m = 0; thisrow = set()
%o A368509         else: m += 1
%o A368509 print(list(islice(agen(), 90))) # _Michael S. Branicky_, Dec 28 2023
%Y A368509 Cf. A342585.
%K A368509 nonn,tabf
%O A368509 1,5
%A A368509 _Tamas Sandor Nagy_, Dec 28 2023