login
A336164
a(1) = 1; if n>1, and gcd(a(n-1), n) > 1 then a(n) = a(n-1)/gcd(a(n-1), n), otherwise a(n) = a(n-1) + n - 1.
0
1, 2, 4, 1, 5, 10, 16, 2, 10, 1, 11, 22, 34, 17, 31, 46, 62, 31, 49, 68, 88, 4, 26, 13, 37, 62, 88, 22, 50, 5, 35, 66, 2, 1, 35, 70, 106, 53, 91, 130, 170, 85, 127, 170, 34, 17, 63, 21, 3, 52, 102, 51, 103, 156, 210, 15, 5, 62, 120, 2, 62, 1, 63, 126, 190, 95, 161, 228, 76
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)
A336164_list = list(islice(A336164_gen(), 30)) # Chai Wah Wu, Mar 18 2023
CROSSREFS
Cf. A133058.
Sequence in context: A080427 A118906 A085059 * A181336 A238731 A124037
KEYWORD
nonn
AUTHOR
Todor Szimeonov, Jul 10 2020
STATUS
approved