login
a(0)=a(1)=1. For n>1, let c=count of all occurrences of a(n-1) in the list so far. If c < abs(a(n-1)), then a(n)=c-a(n-1). Otherwise, a(n)=c.
2

%I #19 May 21 2023 23:33:32

%S 1,1,2,-1,1,3,-2,3,-1,2,2,3,3,4,-3,4,-2,2,4,-1,3,5,-4,5,-3,5,-2,3,6,

%T -5,6,-4,6,-3,3,7,-6,7,-5,7,-4,7,-3,4,4,5,-1,4,6,-2,4,7,-2,5,5,6,-1,5,

%U 7,-1,6,6,7,7,8,-7,8,-6,8,-5,8,-4,4,8,-3,5,8,-2

%N a(0)=a(1)=1. For n>1, let c=count of all occurrences of a(n-1) in the list so far. If c < abs(a(n-1)), then a(n)=c-a(n-1). Otherwise, a(n)=c.

%C This is a variant of A363083.

%H Gavin Lupo, <a href="/A363086/b363086.txt">Table of n, a(n) for n = 0..50000</a>

%H Gavin Lupo, <a href="/A363086/a363086.png">Image of the first 1000000 terms</a>

%e a(0) = 1

%e a(1) = 1

%e a(2) = 2. Two 1's in the list so far. 2 > abs(1). c = 2.

%e a(3) = -1. One 2 in the list so far. 1 < abs(2). 1 - 2 = -1.

%e a(4) = 1. One -1 in the list so far. 1 = abs(-1). c = 1.

%o (Python)

%o from itertools import islice

%o from collections import Counter

%o def agen(): # generator of terms

%o an, c = 1, Counter([1, 1])

%o yield from [1, 1]

%o while True:

%o an = c[an]-an if c[an] < abs(an) else c[an]

%o c[an] += 1

%o yield an

%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 19 2023

%Y Cf. A363083.

%K sign,easy,look

%O 0,3

%A _Gavin Lupo_, May 18 2023