login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 3
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
EXAMPLE
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.
PROG
(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
CROSSREFS
Cf. A354971.
Sequence in context: A221057 A094366 A341372 * A124018 A309288 A235061
KEYWORD
nonn,easy
AUTHOR
Neal Gersh Tolunsky, May 20 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 15 03:01 EDT 2024. Contains 375172 sequences. (Running on oeis4.)