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.

Showing 1-1 of 1 results.

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.

Original entry on oeis.org

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

Views

Author

Gavin Lupo, May 18 2023

Keywords

Comments

This is a variant of A363083.

Examples

			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.
		

Crossrefs

Cf. A363083.

Programs

  • 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
Showing 1-1 of 1 results.