OFFSET
1,3
COMMENTS
Original definition was "Iterates phi, phi, sigma, phi, phi, sigma, ...".
LINKS
Alois P. Heinz, Rows n = 1..1000, flattened
L. Alaoglu and P. Erdős, A conjecture in elementary number theory, Bull. Amer. Math. Soc. 50 (1944), 881-882.
EXAMPLE
Triangle begins:
1,
1,
2, 3, 2, 1,
2, 3, 2, 1,
4, 7, 6, 2, 3, 2, 1,
2, 3, 2, 1,
6, 12, 4, 2, 3, 2, 1,
4, 7, 6, 2, 3, 2, 1,
6, 12, 4, 2, 3, 2, 1,
4, 7, 6, 2, 3, 2, 1,
...
For row n=5, for example, we get (5 -> ) phi(5) = 4 -> sigma(4) = 7 -> phi(7) = 6 -> phi(6) = 2 -> sigma(2) = 3 -> phi(3) = 2 -> phi(2) = 1 (stop).
MAPLE
with(numtheory):
T:= proc(n) local l, m; l:= [][]; m:= n;
do m:= phi(m); l:= l, m; if m=1 then break fi;
m:= sigma(m); l:= l, m; if m=1 then break fi;
m:= phi(m); l:= l, m; if m=1 then break fi
od; l
end:
seq(T(n), n=1..20); # Alois P. Heinz, May 19 2020
MATHEMATICA
f[n_, i_] := If[Mod[i, 3] == 2, DivisorSigma[1, n], EulerPhi[n]]; g[n_] := Module[{i = 1, k = n, s = {}}, While[k > 1 || i == 1, k = f[k, i++]; AppendTo[s, k]; ]; s]; Array[g, 15] // Flatten (* Amiram Eldar, May 10 2020 *)
PROG
(Sage)
N = 10
n = 1
seq = []
while n < N:
a = euler_phi(n)
seq.append(a)
i = 0
while a != 1:
if i%3 == 0:
a = sigma(a)
else:
a = euler_phi(a)
seq.append(a)
i += 1
n += 1
# John Machacek, May 08 2020
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Ursula Gagelmann (gagelmann(AT)altavista.net), Apr 07 1998
EXTENSIONS
Entry revised by N. J. A. Sloane, May 09 2020. Thanks to Amiram Eldar and John Machacek for reconstructing the lost definition of this sequence.
STATUS
approved