cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A358338 a(n) = abs(a(n-1) - count(a(n-1))) where count(a(n-1)) is the number of times a(n-1) has appeared so far in the sequence, a(1)=0.

This page as a plain text file.
%I A358338 #24 Dec 10 2023 09:15:27
%S A358338 0,1,0,2,1,1,2,0,3,2,1,3,1,4,3,0,4,2,2,3,1,5,4,1,6,5,3,2,4,0,5,2,5,1,
%T A358338 7,6,4,1,8,7,5,0,6,3,3,4,2,6,2,7,4,3,5,1,9,8,6,1,10,9,7,3,6,0,7,2,8,5,
%U A358338 2,9,6,1,11,10,8,4,4,5,3,7,1,12,11,9,5,4
%N A358338 a(n) = abs(a(n-1) - count(a(n-1))) where count(a(n-1)) is the number of times a(n-1) has appeared so far in the sequence, a(1)=0.
%C A358338 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.
%C A358338 The following comments are only empirical observations:
%C A358338 ceiling(sqrt(2n)) is an excellent envelope of a(n) with no exceptions found in the first 50000 terms.
%C A358338 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).
%C A358338 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.
%H A358338 Clément Vovard, <a href="/A358338/b358338.txt">Table of n, a(n) for n = 1..10000</a>
%e A358338 For n=2, a(2-1)=0 and 0 has occurred 1 time so far so a(2)=abs(0-1)=1.
%e A358338 For n=12, a(12-1)=1 and 1 has occurred 4 times so far so a(12)=abs(1-4)=3.
%o A358338 (Python)
%o A358338 from collections import Counter
%o A358338 def aupton(terms):
%o A358338     alst, inventory = [0], Counter([0])
%o A358338     for n in range(2, terms+1):
%o A358338         c = abs(alst[-1] - inventory[alst[-1]])
%o A358338         alst.append(c); inventory[c] += 1
%o A358338     return alst
%o A358338 print(aupton(85)) # _Michael S. Branicky_, Nov 10 2022
%Y A358338 Cf. A337835, A340488, A342585.
%K A358338 nonn,easy
%O A358338 1,4
%A A358338 _Clément Vovard_, Nov 10 2022