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.
%I A337835 #98 Nov 13 2022 02:04:07 %S A337835 0,1,0,2,-1,2,0,3,-2,3,-1,3,0,4,-3,4,-2,4,-1,4,0,5,-4,5,-3,5,-2,5,-1, %T A337835 5,0,6,-5,6,-4,6,-3,6,-2,6,-1,6,0,7,-6,7,-5,7,-4,7,-3,7,-2,7,-1,7,0,8, %U A337835 -7,8,-6,8,-5,8,-4,8,-3,8,-2,8,-1,8,0,9,-8,9,-7,9,-6,9,-5,9,-4,9,-3,9 %N A337835 a(1) = 0 and for n > 1, a(n+1) = k - a(n) where k is the number of terms equal to a(n) among the first n terms. %C A337835 Empirical observation: -A000194(n) <= a(n) <= A000194(n). %H A337835 Bence BernĂ¡th, <a href="/A337835/b337835.txt">Table of n, a(n) for n = 1..10000</a> %e A337835 For n = 4, a(4) = 2, which appeared only once in the sequence so a(5)=1-2=-1. %t A337835 a = {0}; Do[AppendTo[a, Count[a, a[[-1]]] - a[[-1]]], {100}]; a (* _Amiram Eldar_, Nov 18 2020 *) %t A337835 a[1] = 0; a[n_Integer?Positive] := a[n] = Count[Array[a, n - 1], a[n - 1]] - a[n - 1]; Array[a, 101] (* _Jan Mangaldan_, Nov 27 2020 *) %o A337835 (MATLAB) %o A337835 length=1000; %o A337835 sequence(1)=0; %o A337835 for n=2:1:length %o A337835 sequence(n)=nnz(sequence==sequence(end))-sequence(n-1); %o A337835 end %o A337835 (PARI) lista(nn) = {my(va = vector(nn)); for (n=2, nn, va[n] = #select(x->(x==va[n-1]), vector(n-1, k, va[k])) - va[n-1];); va;} \\ _Michel Marcus_, Nov 18 2020 %o A337835 (Python) %o A337835 from itertools import islice %o A337835 from collections import Counter %o A337835 def agen(): # generator of terms %o A337835 an, k = 0, Counter() %o A337835 while True: %o A337835 yield an %o A337835 k[an] += 1 %o A337835 an = k[an] - an %o A337835 print(list(islice(agen(), 86))) # _Michael S. Branicky_, Nov 12 2022 %Y A337835 Cf. A000194, A329985. %K A337835 sign,easy %O A337835 1,4 %A A337835 _Bence BernĂ¡th_, Nov 17 2020