login
A364918
a(1) = 1; for n >= 2, a(n) = a(n - GCD(n - 1, a(n - 1))) + GCD(n, a(n - 1)).
2
1, 2, 2, 4, 2, 4, 3, 4, 3, 4, 4, 8, 4, 6, 7, 8, 4, 6, 5, 10, 5, 6, 6, 12, 5, 6, 8, 12, 6, 12, 6, 8, 6, 8, 7, 7, 8, 10, 9, 9, 10, 12, 9, 10, 14, 16, 15, 18, 10, 20, 11, 12, 11, 12, 11, 15, 18, 13, 14, 16, 19, 20, 20, 24, 19, 20, 20, 24, 22, 24, 23, 24, 11, 12, 14, 16, 12
OFFSET
1,2
EXAMPLE
a(1) = 1.
a(2) = a(2 - gcd(1, a(1))) + gcd(2, a(1)) = a(1) + 1 = 2.
a(3) = a(3 - gcd(2, a(2))) + gcd(3, a(2)) = a(1) + 1 = 2.
a(4) = a(4 - gcd(3, a(3))) + gcd(4, a(3)) = a(3) + 2 = 4.
and so on.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = a[n - GCD[n - 1, a[n - 1]]] + GCD[n, a[n - 1]]; Array[a, 100]
PROG
(PARI) { for (n = 1, #a = vectorsmall(77), print1 (a[n] = if (n==1, 1, a[n - gcd(n - 1, a[n - 1])] + gcd(n, a[n - 1]))", "); ); } \\ Rémy Sigrist, Feb 06 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Feb 06 2024
STATUS
approved