[go: up one dir, main page]

login
A348967
Variation on the Inventory Sequence A342585: record the number of occurrences of the pair difference of all adjacent terms until 0 is recorded, then restart the count from 0. Start with a(0) = 0. See the Comments.
3
0, 0, 1, 1, 0, 2, 2, 1, 0, 3, 4, 1, 2, 0, 3, 6, 2, 4, 1, 0, 3, 7, 3, 6, 3, 0, 3, 7, 3, 10, 5, 1, 0, 3, 8, 3, 11, 6, 4, 0, 3, 8, 4, 12, 8, 5, 0, 3, 8, 4, 14, 10, 7, 0, 3, 8, 4, 16, 12, 8, 0, 3, 8, 4, 17, 15, 9, 1, 2, 4, 0, 3, 9, 6, 19, 16, 9, 2, 4, 4, 0, 4, 9, 7, 20, 18, 10, 2, 4, 6, 0, 4, 9, 11
OFFSET
0,6
COMMENTS
This sequence is a variation of A342585. Here we record the number of previous occurrences of the pair differences of all adjacent terms until 0 is recorded, after which the pair difference count restarts at 0. For example the terms 0,0,2,1,3 contain one pair with a difference of 0 (0,0), one pair with a difference of 1 (2,1), and two pairs with a difference of 2 (0,2 and 1,3). See the Examples below.
After 20 million terms the largest term is a(19995157) = 2537781, which counts the occurrences of pairs with a difference of 1, while there are 5725 terms between zeros. It is likely the most common pair difference remains at 1 as n increases although this is unknown.
EXAMPLE
a(1) = 0 as there have been no pairs so far in the sequence.
a(2) = 1 as there has been one pair with a difference of 0: |a(1) - a(0)|.
a(3) = 1 as there has been one pair with a difference of 1: |a(2) - a(1)|.
a(4) = 0 as there has been no pairs with a difference of 2. The count now resets to 0.
a(5) = 2 as there has been two pairs with a difference of 0: |a(1) - a(0)|, |a(3) - a(2)|.
a(6) = 2 as there has been two pairs with a difference of 1: |a(2) - a(1)|, |a(4) - a(3)|.
a(7) = 1 as there has been one pair with a difference of 2: |a(5) - a(4)|.
PROG
(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([abs(alst[-2] - alst[-1])])
return alst
print(aupton(93)) # Michael S. Branicky, Nov 05 2021
CROSSREFS
Cf. A342585, A348966 (pair sums).
Sequence in context: A285099 A306754 A063250 * A285308 A276543 A107424
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 05 2021
STATUS
approved