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.
LINKS
Scott R. Shannon, Image of the first 100000 terms.
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
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Nov 05 2021
STATUS
approved