A348966 Variation on the Inventory Sequence A342585: record the number of occurrences of the pair sum of all adjacent terms until 0 is recorded, then restart the count from 0. Start with a(0) = 0. See the Comments.
0, 0, 1, 1, 1, 0, 1, 3, 2, 0, 1, 4, 3, 0, 1, 5, 3, 1, 2, 2, 1, 1, 1, 0, 1, 7, 5, 3, 3, 2, 2, 1, 3, 0, 1, 8, 5, 5, 5, 3, 2, 1, 4, 1, 2, 0, 1, 9, 6, 7, 5, 6, 2, 1, 5, 1, 3, 1, 2, 2, 0, 1, 10, 7, 9, 8, 6, 4, 1, 5, 1, 4, 2, 2, 2, 1, 1, 1, 2, 0, 1, 11, 10, 11, 10, 8, 7, 1, 6, 1, 4, 2, 3, 2, 1, 2, 1, 2
Offset: 0
Examples
a(1) = 0 as there have been no pairs so far in the sequence. a(2) = 1 as there has been one pair that sums to 0: a(0) + a(1). a(3) = 1 as there has been one pair that sums to 1: a(1) + a(2). a(4) = 1 as there has been one pair that sums to 2: a(2) + a(3). a(5) = 0 as there have been no pairs that sum to 3. The count now resets to 0. a(6) = 1 as there has been one pair that sums to 0: a(0) + a(1). a(7) = 3 as there have been three pairs that sum to 1: a(1) + a(2), a(4) + a(5), a(5) + a(6).
Links
- Scott R. Shannon, Image of the first 1 million terms.
Programs
-
Python
from collections import Counter def aupton(terms): num, alst, inventory = 0, [0, 0], Counter([0]) for n in range(2, terms+1): c = inventory[num] num = 0 if c == 0 else num + 1 alst.append(c) inventory.update([alst[-2] + alst[-1]]) return alst print(aupton(97)) # Michael S. Branicky, Nov 05 2021
Comments