STATUS
editing
approved
editing
approved
nxt[{n_, a_}]:=Module[{ph=EulerPhi[n+1]}, {n+1, If[ph>a, a+ph, a-ph]}]; NestList[nxt, {0, 0}, 80][[;; , 2]] (* Harvey P. Dale, Jun 14 2023 *)
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
a[0] = 0; a[n_] := a[n] = With[{phi = EulerPhi[n], a1 = a[n-1]}, If[phi>a1, a1+phi, a1-phi]];
a /@ Range[0, 80] (* Jean-François Alcover, Nov 01 2020 *)
approved
editing
editing
approved
a:= proc(n) option remember; `if`(n<1, 0, ((s, t)-> s+
`if`(s<t, t, -t))(a(n-1), numtheory[phi](n)))
end:
seq(a(n), n=0..80); # Alois P. Heinz, Jan 11 2020
Cf. A000010.
approved
editing
editing
approved