OFFSET
1,5
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
T:= proc(n, k) option remember;
if n*k = 0 then 0 else (n mod k) + procname(k, n mod k) fi
end proc:
seq(add(T(n, k), k=1..n), n=1..100); # Robert Israel, Aug 31 2015
MATHEMATICA
T[n_, k_] := T[n, k] = If[n*k == 0, 0, Mod[n, k] + T[k, Mod[n, k]]];
a[n_] := Sum[T[n, k], {k, 1, n}];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Sep 16 2022, after Robert Israel *)
PROG
(PARI) t(n, k) = {x = n; y = k; r = 1; s = 0; while (r, q = x\y; r = x - y*q; s +=r; x = y; y = r; ); s; }
a(n) = sum(k=1, n, t(n, k)); \\ Michel Marcus, Aug 31 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved