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.

A363193 a(1)=1, and thereafter a(n) = number of occurrences of a(k) among terms a(1..k), where k = n-a(n-1).

Original entry on oeis.org

1, 1, 2, 2, 1, 3, 2, 1, 4, 1, 5, 3, 5, 1, 6, 5, 2, 3, 3, 4, 4, 3, 2, 5, 2, 4, 5, 5, 4, 4, 5, 5, 6, 6, 5, 7, 6, 8, 7, 2, 2, 7, 1, 7, 1, 8, 2, 2, 9, 8, 7, 8, 8, 2, 5, 5, 4, 11, 10, 3, 1, 9, 11, 5, 6, 6, 9, 1, 10, 6, 5, 3, 7, 3, 7, 2, 7, 13, 6, 8, 6, 12, 13, 13, 7, 8
Offset: 1

Views

Author

Neal Gersh Tolunsky, May 20 2023

Keywords

Examples

			For n=5, a(5) is the number of times a(5 - a(5-1)) = a(5 - a(4)) = a(3) = 2 has occurred in the sequence among a(1..3). It has occurred 1 time up to that point, so a(5)=1.
		

Crossrefs

Cf. A354971.

Programs

  • Python
    from bisect import bisect
    from itertools import count, islice
    def agen(): # generator of terms
        an, a, locs = 1, [None, 1], {1: [1]}
        yield 1
        for n in count(2):
            k = n-an
            an = bisect(locs[a[k]], k) # sum(1 for i in locs[a[k]] if i <= k)
            a.append(an)
            if an not in locs: locs[an] = []
            locs[an].append(n)
            yield an
    print(list(islice(agen(), 86))) # Michael S. Branicky, May 23 2023