OFFSET
1,2
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..31
EXAMPLE
MAPLE
PROG
(Python)
from itertools import count, islice
def A365199_gen(): # generator of terms
yield (a:=1)
for n in count(2):
if a<n:
a += n
elif a==n:
a = n**2
elif a%n:
a -= n
else:
a //= n
if a == 1:
yield n
CROSSREFS
KEYWORD
nonn,hard
AUTHOR
Felix Huber, Aug 26 2023
EXTENSIONS
a(22)-a(23) from Michel Marcus, Aug 28 2023
a(24)-a(28) from Chai Wah Wu, Sep 23 2023
STATUS
approved