|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|