OEIS A347062, a sequence of David Sycamore, Mevagissey, England.
Written by Michael Thomas De Vlieger, St. Louis, Missouri, 2021 1017.
We consider an inventory sequence one beginning with a seed (usually 0) that reports cardinality c(m) of numbers m that appear in the sequence in turn following a reset triggered by the report of a zero. The turns involve reporting the number of 0s, then 1s, then 2s, etc. until we write a 0, wherein we return to reporting the number of 0s once again. Because of this, we may partition the sequence into segments or cycles delimited by occasions of 0. If the sequence starts with seed 0, then this should be deemed the zeroth or first such cycle. Subsequent cycles include a number of nonzero terms ending with a zero. Thus we might see the sequence an irregular triangle T(n,k), where n represents the cycle number, and k an index in the cycle that governs the reports of cardinalities c(k).
It is clear that the register c(m) may increment even when it hasn’t reported, and that the scatterplot will exhibit a series of trajectories associated with the registers c(m). Every alteration of the registers is not visible, since increment may occur after a report in a given cycle. We expect the cycle length ℓ to be nondecreasing.
The inventory sequence as such stands to be a pure sequence of counting and millions of terms can be calculated in short order, resulting in a scatterplot characterized by nondecreasing periodicity and trajectory.
Joseph Rozhenko wrote the original inventory sequence OEIS A342585. This sequence merely counts m and reports c(m) in turn, i.e., c(0), c(1), c(2), etc. until we encounter a null register; it is the simplest version of the inventory sequence as such and is a fast computation study.
We consider a variant A347062 = a such that we start with a(0) = 0, thereafter, after the appearance of a zero, we report the number of numbers that follow the term k in the sequence starting with k = 0 and proceeding until we report a null register (i.e., a 0), and we recommence with reporting the number of records, the number of 0s, the number of 1s, etc. In terms of computation, we assign the register c(−1) to records.
The sequence a begins as follows:
0, 0, 1, 0, 2, 1, 1, 0, 3, 3, 1, 2, 0, 4, 4, 2, 2, 2, 0, 5, 4, 5, 2, 3, 2, 0, 6, 4, 7, 3, 4, 2, 1, 1, 0, 7, 6, 8, 4, 5, 2, 2, 2, 1, 0, 8, 7, 11, 4, 6, 3, 3, 3, 2, 0, 9, 7, 12, 7, 7, 3, 3, 6, 2, 1, 0, 10, 8, 13, 9, 7, 3, 4, 7, 3, 2, 1, 1, 1, 1, 0, 11, 12, 14, 11, 8, 3, 4, 8, 4, 2, 1, 3, 2, 1, 1, 0, ...
This sequence can be generated by Code 1. We have generated 212 cycles = 16298699 terms, but have also analyzed 10000 cycles (98164830 terms).
Table 1 lists terms 0 ≤ k in cycles 0 ≤ n ≤ 11:
n: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
--------------------------------------------------
0: 0
1: 0
2: 1 0
3: 2 1 1 0
4: 3 3 1 2 0
5: 4 4 2 2 2 0
6: 5 4 5 2 3 2 0
7: 6 4 7 3 4 2 1 1 0
8: 7 6 8 4 5 2 2 2 1 0
9: 8 7 11 4 6 3 3 3 2 0
10: 9 7 12 7 7 3 3 6 2 1 0
11: 10 8 13 9 7 3 4 7 3 2 1 1 1 1 0
...
Table 2 lists the number of m in row 0 ≤ n ≤ 11 of a, writing “.” for zero for clarity. Hence, for n = 5, there is 1 zero, no 1s, three 2s, no 3s, and two 4s.
n: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
----------------------------------------------
0: 1
1: 1
2: 1 1
3: 1 2 1
4: 1 1 1 2
5: 1 . 3 . 2
6: 1 . 2 1 1 2
7: 1 2 1 1 2 . 1 1
8: 1 1 3 . 1 1 1 1 1
9: 1 . 1 3 1 . 1 1 1 . . 1
10: 1 1 1 2 . . 1 3 . 1 . . 1
11: 1 4 1 2 1 . . 2 1 1 1 . . 1
...
The records r include the following:
0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 25, 27, 29, 32, 33, 36, 37, 41, 47, 52, 55, 58, 62, 67, 71, 75, 76, 77, 80, 82, 84, 89, 95, 103, 111, 120, 131, 148, 168, 188, 206, 222, 235, 248, 261, 273, 285, 297, 309, 321, 333, 344, 355, 365, 379, 392, 403, 412, 422, 430, 439, 447, 454, 462, 470, 478, 487, 497, 506, 514, 520, ...
These appear at the following indices in s:
0, 2, 4, 8, 13, 19, 26, 28, 37, 47, 57, 68, 83, 98, 99, 116, 117, 134, 135, 153, 171, 195, 196, 219, 220, 243, 244, 268, 292, 316, 340, 365, 397, 429, 461, 493, 557, 589, 624, 663, 706, 752, 798, 844, 890, 936, 1007, 1078, 1149, 1228, 1307, 1386, 1465, 1544, 1623, 1702, 1781, 1860, 1939, 2018, ...
Given 4098 cycles, there are 4122 records. The records appear on average 1 to a cycle, however there are cycles that never set records (assuming the zeroth cycle constitutes a(0) = 0, these are cycles 1 and 30; are there any others?), and there are cycles that feature 2 records:
7, 13, 14, 15, 18, 19, 20, 166, 167, 201, 202, 242, 243, 244, 245, 246, 247, 267, 268, 269, 270, 1641, 1642, 1643, 1644, 1645, ...
Many of these indices occur in runs, we might abbreviate thus:
7, 13..15, 18..20, 166..167, 201..202, 242..247, 267..270, 1641..1645, ...
Are there any cycles that set 3 records?
Furthermore, records tend to be set in the first term for the first dozen or so cycles, but as n increases, the records occur later in the cycle.
Figure 1: Scatterplot of a(n) for 1 ≤ n ≤ 552, or rows 0..31.
The scatterplot of course exhibits trajectories associated with the reporting of c(m) at most once per cycle.
Figure 2: Labeled scatterplot of a(n) for 0 ≤ n ≤ 335, showing 24 cycles. The colors pertain to certain trajectories. Black = c(0), red = c(1), orange = c(2), yellow = c(3), green = c(4), blue = c(5), purple = c(6).
Figure 3: Scatterplot of a(n) for 0 ≤ n ≤ 39554, showing 256 cycles. The colors pertain to certain trajectories. Black = c(0), red = c(1), orange = c(2), yellow = c(3), green = c(4), blue = c(5), purple = c(6).
We may derive row lengths ℓ and sums s. Sequence ℓ begins as follows:
1, 1, 2, 4, 5, 6, 7, 9, 10, 10, 11, 15, 16, 18, 18, 18, 18, 24, 24, 24, 24, 24, 24, 24, 25, 32, 32, 32, 32, 32, 32, 32, 35, 39, 43, 46, 46, 46, 46, 46, 71, 71, 71, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 86, 86, 86, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, ...
This leads to a sequence z of indices of 0 in a via z = −1 + partial sums of ℓ:
0, 1, 3, 7, 12, 18, 25, 34, 44, 54, 65, 80, 96, 114, 132, 150, 168, 192, 216, 240, 264, 288, 312, 336, 361, 393, 425, 457, 489, 521, 553, 585, 620, 659, 702, 748, 794, 840, 886, 932, 1003, 1074, 1145, 1224, 1303, 1382, 1461, 1540, 1619, 1698, 1777, 1856, 1935, 2014, 2093, 2172, 2251, 2337, 2423, 2509, 2601, 2693, 2785, 2877, 2969, 3061, 3153, 3245, 3337, 3429, 3521, 3613, 3705, 3797, 3889, 3981, 4073, 4165, 4258, 4351, ...
Figure 4: Log-log scatterplot of ℓ(n) for 0 ≤ n ≤ 10000:
The row sums s begin as follows:
0, 0, 1, 4, 9, 14, 21, 28, 37, 47, 57, 70, 85, 101, 117, 132, 148, 172, 194, 215, 235, 255, 275, 295, 317, 353, 381, 409, 437, 465, 493, 521, 551, 586, 625, 667, 707, 747, 788, 829, 914, 980, 1046, 1125, 1199, 1274, 1347, 1420, 1492, 1564, 1636, 1708, 1781, 1853, 1925, 1998, 2070, 2156, 2235, 2314, 2400, 2485, 2570, 2655, 2739, 2823, 2907, 2991, 3075, 3159, 3243, 3327, 3411, 3495, 3579, 3663, 3746, 3829, 3912, 3995, ...
This concludes our examination.
Block[{c, k, m, n},
c[0] = 1; m = 0;
{0, 0}~Join~Reap[Do[k = 0;
While[IntegerQ[c[k]], Set[n, c[k]]; Sow[n];
If[IntegerQ@ c[m], c[m]++, c[m] = 1]; Set[m, n]; k++]; Sow[0];
If[IntegerQ@ c[m], c[m]++, c[m] = 1]; Set[m, 0], 2^8]][[-1, -1]]]
A342585: The inventory sequence.
A343880: Indices of 0 in A342585.
A347299: Row lengths of A342585.
A347315: Row sums of A342585.
A347316:
Irregular triangle read by rows: T(n,k) = number of times k appears in n-th row of A342585.
A347317: Version of A342585 that admits interposing null registers and reports all registers with value.
A347062: Sequence a.
2021 1017 1720 Original version.