%I #26 May 21 2023 23:33:37
%S 1,1,2,1,3,2,5,3,-2,-5,-3,2,-1,1,0,1,1,2,3,5,2,7,5,-2,3,1,4,3,7,4,-3,
%T -7,-4,3,-1,2,1,3,4,1,5,4,9,5,14,9,-5,-14,-9,5,-4,-9,-5,4,-1,3,2,5,7,
%U 2,9,7,-2,5,3,8,5,13,8,-5,-13,-8,5,-3,2,-1,1,0
%N a(0)=a(1)=1. For n>1, if the number of occurrences of a(n-1) is less than abs(a(n-1)), then a(n)=a(n-1)-a(n-2). Otherwise, a(n)=a(n-1)+a(n-2).
%H Gavin Lupo, <a href="/A363083/b363083.txt">Table of n, a(n) for n = 0..50000</a>
%H Gavin Lupo, <a href="/A363083/a363083.png">Image of the first 100000 terms.</a>
%H Gavin Lupo, <a href="/A363083/a363083_1.png">Image of the first 1000000 terms.</a>
%H Gavin Lupo, <a href="/A363083/a363083_2.png">Image of the first 10000000 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). 1 + 1 = 2.
%e a(3) = 1. One 2 in the list so far. 1 < abs(2). 2 - 1 = 1.
%e a(4) = 3. Three 1's in the list so far. 3 > abs(1). 1 + 2 = 3.
%o (Python)
%o from itertools import islice
%o from collections import Counter
%o def agen(): # generator of terms
%o anprev, an, c = 1, 1, Counter([1])
%o yield 1
%o while True:
%o yield an
%o c[an] += 1
%o anprev, an = an, an-anprev if c[an] < abs(an) else an+anprev
%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, May 18 2023
%Y Cf. A329985, A362746, A362890, A363086.
%K sign,easy,look
%O 0,3
%A _Gavin Lupo_, May 18 2023