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-2 of 2 results.

A362890 a(1)=a(2)=1. For n>2, a(n) is the number of times that a(n-1) and a(n-2) are adjacent in the sequence thus far (in any order).

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 3, 1, 1, 3, 2, 2, 1, 4, 1, 2, 5, 1, 1, 4, 3, 1, 3, 4, 2, 1, 6, 1, 2, 7, 1, 1, 5, 2, 2, 2, 3, 3, 1, 5, 3, 1, 6, 3, 1, 7, 2, 2, 4, 2, 3, 4, 3, 4, 5, 1, 4, 4, 1, 5, 5, 1, 6, 4, 1, 6, 5, 1, 7, 3, 1, 8, 1, 2, 8, 1, 3, 9, 1, 1, 6, 6, 1, 7, 4, 1
Offset: 1

Views

Author

Neal Gersh Tolunsky, May 08 2023

Keywords

Comments

This is a variant of A362746.

Examples

			a(4)=2 because a(2) and a(3) = (1, 1) appear as a contiguous pair at 2 locations: at indices (1, 2) and (2, 3).
a(7)=3 because a(5) and a(6) = (1, 2) appear as a contiguous pair at 3 locations: at indices (3, 4), (4, 5), (5, 6).
		

Crossrefs

Cf. A362746.

Programs

  • Python
    from itertools import islice
    from collections import Counter
    def k(c, d): return (c, d) if c <= d else (d, c)
    def agen(): # generator of terms
        an, anext, c = 1, 1, Counter({(1, 1)})
        while True:
            yield an
            an, anext = anext, c[k(an, anext)]
            c[k(an, anext)] += 1
    print(list(islice(agen(), 100))) # Michael S. Branicky, May 09 2023

A363083 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).

Original entry on oeis.org

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, -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, 2, 9, 7, -2, 5, 3, 8, 5, 13, 8, -5, -13, -8, 5, -3, 2, -1, 1, 0
Offset: 0

Views

Author

Gavin Lupo, May 18 2023

Keywords

Examples

			a(0) = 1
a(1) = 1
a(2) = 2. Two 1's in the list so far.    2 > abs(1).   1 + 1 = 2.
a(3) = 1. One 2 in the list so far.      1 < abs(2).   2 - 1 = 1.
a(4) = 3. Three 1's in the list so far.  3 > abs(1).   1 + 2 = 3.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from collections import Counter
    def agen(): # generator of terms
        anprev, an, c = 1, 1, Counter([1])
        yield 1
        while True:
            yield an
            c[an] += 1
            anprev, an = an, an-anprev if c[an] < abs(an) else an+anprev
    print(list(islice(agen(), 80))) # Michael S. Branicky, May 18 2023
Showing 1-2 of 2 results.