Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A363086
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
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, -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, 7, -1, 6, 6, 7, 7, 8, -7, 8, -6, 8, -5, 8, -4, 4, 8, -3, 5, 8, -2
OFFSET
0,3
COMMENTS
This is a variant of A363083.
EXAMPLE
a(0) = 1
a(1) = 1
a(2) = 2. Two 1's in the list so far. 2 > abs(1). c = 2.
a(3) = -1. One 2 in the list so far. 1 < abs(2). 1 - 2 = -1.
a(4) = 1. One -1 in the list so far. 1 = abs(-1). c = 1.
PROG
(Python)
from itertools import islice
from collections import Counter
def agen(): # generator of terms
an, c = 1, Counter([1, 1])
yield from [1, 1]
while True:
an = c[an]-an if c[an] < abs(an) else c[an]
c[an] += 1
yield an
print(list(islice(agen(), 80))) # Michael S. Branicky, May 19 2023
CROSSREFS
Cf. A363083.
Sequence in context: A117506 A179205 A055089 * A060117 A196526 A234504
KEYWORD
sign,easy,look
AUTHOR
Gavin Lupo, May 18 2023
STATUS
approved