OFFSET
1,2
PROG
(PARI) a(n) = if (n==1, 1, my(prec=a(n-1)); if (gcd(prec, n) > 1, prec/gcd(prec, n), n-1+prec)); \\ Michel Marcus, Jul 13 2020
(Python)
from itertools import count, islice
from math import gcd
def A336164_gen(): # generator of terms
yield (a:=1)
for n in count(2):
yield (a:=a+n-1 if (b:=gcd(a, n)) == 1 else a//b)
CROSSREFS
KEYWORD
nonn
AUTHOR
Todor Szimeonov, Jul 10 2020
STATUS
approved