cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A327442 a(0) = 0; thereafter a(n) = a(n-1) + phi(n) if phi(n) > a(n-1), otherwise a(n) = a(n-1) - phi(n), where phi is the Euler phi-function A000010.

This page as a plain text file.
%I A327442 #15 Jun 14 2023 13:26:01
%S A327442 0,1,0,2,0,4,2,8,4,10,6,16,12,0,6,14,6,22,16,34,26,14,4,26,18,38,26,8,
%T A327442 20,48,40,10,26,6,22,46,34,70,52,28,12,52,40,82,62,38,16,62,46,4,24,
%U A327442 56,32,84,66,26,2,38,10,68,52,112,82,46,14,62,42,108,76,32,8,78,54,126,90
%N A327442 a(0) = 0; thereafter a(n) = a(n-1) + phi(n) if phi(n) > a(n-1), otherwise a(n) = a(n-1) - phi(n), where phi is the Euler phi-function A000010.
%H A327442 N. J. A. Sloane, <a href="/A327442/b327442.txt">Table of n, a(n) for n = 0..9999</a>
%p A327442 a:= proc(n) option remember; `if`(n<1, 0, ((s, t)-> s+
%p A327442      `if`(s<t, t, -t))(a(n-1), numtheory[phi](n)))
%p A327442     end:
%p A327442 seq(a(n), n=0..80);  # _Alois P. Heinz_, Jan 11 2020
%t A327442 a[0] = 0; a[n_] := a[n] = With[{phi = EulerPhi[n], a1 = a[n-1]}, If[phi>a1, a1+phi, a1-phi]];
%t A327442 a /@ Range[0, 80] (* _Jean-François Alcover_, Nov 01 2020 *)
%t A327442 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 *)
%Y A327442 Cf. A000010, A008344.
%K A327442 nonn
%O A327442 0,4
%A A327442 _N. J. A. Sloane_, Sep 12 2019