OFFSET
1,4
COMMENTS
This sequence is related to the inventory sequence (A342585) as it uses the number of times a number has occurred so far in the sequence.
The following comments are only empirical observations:
ceiling(sqrt(2n)) is an excellent envelope of a(n) with no exceptions found in the first 50000 terms.
When x > 3 appears for the first time, it seems to always be preceded by a 1 and followed by x-1. Also, x-1 will already have occurred earlier in the sequence (new highest terms grow by 1).
The number of times x > 0 appears in the first k terms seems to approximately equal sqrt(2k)-x-1. Therefore, 1 appears approximately sqrt(2k) times. The highest term that has appeared in k terms is then approximately sqrt(2k), which also makes sense considering the number of times 1 appears and the fact that a new number is preceded by 1. The only exception is 0, which appears approximately sqrt(2k)/2 times.
LINKS
Clément Vovard, Table of n, a(n) for n = 1..10000
EXAMPLE
For n=2, a(2-1)=0 and 0 has occurred 1 time so far so a(2)=abs(0-1)=1.
For n=12, a(12-1)=1 and 1 has occurred 4 times so far so a(12)=abs(1-4)=3.
PROG
(Python)
from collections import Counter
def aupton(terms):
alst, inventory = [0], Counter([0])
for n in range(2, terms+1):
c = abs(alst[-1] - inventory[alst[-1]])
alst.append(c); inventory[c] += 1
return alst
print(aupton(85)) # Michael S. Branicky, Nov 10 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clément Vovard, Nov 10 2022
STATUS
approved