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.

Original entry on oeis.org

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

Views

Author

Tamas Sandor Nagy, Dec 28 2023

Keywords

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.

Examples

			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;
  ...
		

Crossrefs

Cf. A342585.

Programs

  • 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