login
A361672
a(1) = a(2) = 1; for n > 2, a(n) = a(n-2) + a(n-1) + n if a(n-1) and n are coprime, otherwise a(n) = a(n-1)/gcd(a(n-1), n).
0
1, 1, 5, 10, 2, 1, 10, 5, 24, 12, 47, 71, 131, 216, 72, 9, 98, 49, 166, 83, 270, 135, 428, 107, 560, 280, 867, 1175, 2071, 3276, 5378, 2689, 8100, 4050, 810, 45, 892, 446, 1377, 1863, 3281, 5186, 8510, 4255, 851, 37, 935, 1020, 2004, 1002, 334, 167, 554, 277, 886
OFFSET
1,3
MATHEMATICA
a[1]=a[2]=1; a[n_]:=a[n]=If[GCD[a[n-1], n]==1, a[n-2]+a[n-1]+n, a[n-1]/GCD[a[n-1], n]]; Array[a, 55] (* Stefano Spezia, Mar 20 2023 *)
PROG
(Magma) a:=[1, 1]; for n in [3..50] do if Gcd(a[n-1], n) eq 1 then Append(~a, a[n-2] + a[n-1] + n); else Append(~a, a[n-1] div Gcd(a[n-1], n)); end if; end for; [] cat a;
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Hubert W. Westwood, Mar 20 2023
STATUS
approved