|
|
A003434
|
|
Number of iterations of phi(x) at n needed to reach 1.
(Formerly M0244)
|
|
53
|
|
|
0, 1, 2, 2, 3, 2, 3, 3, 3, 3, 4, 3, 4, 3, 4, 4, 5, 3, 4, 4, 4, 4, 5, 4, 5, 4, 4, 4, 5, 4, 5, 5, 5, 5, 5, 4, 5, 4, 5, 5, 6, 4, 5, 5, 5, 5, 6, 5, 5, 5, 6, 5, 6, 4, 6, 5, 5, 5, 6, 5, 6, 5, 5, 6, 6, 5, 6, 6, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 5, 6, 7, 5, 7, 5, 6, 6, 7, 5, 6, 6, 6, 6, 6, 6, 7, 5, 6, 6, 7, 6, 7, 6, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Each number n>1 occurs for the first time at the position A007755(n+1) and for the last time at 2*3^(n-1). - Ivan Neretin, Mar 24 2015
|
|
REFERENCES
|
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
M. V. Subbarao, On a function connected with phi(n), J. Madras Univ. B. 27 (1957), pp. 327-333.
|
|
LINKS
|
|
|
FORMULA
|
By the definition of a(n) we have for n >= 2 the recursion a(n) = a(phi(n)) + 1. - Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 20 2001
|
|
EXAMPLE
|
If n=164 the trajectory is {164,80,32,16,8,4,2,1}. Its length is 8, thus a(164)=7.
|
|
MAPLE
|
local a, e;
e := n ;
a :=0 ;
while e > 1 do
a := a+1 ;
e := numtheory[phi](e) ;
end do:
a;
end proc:
|
|
MATHEMATICA
|
f[n_] := Length@ NestWhileList[ EulerPhi, n, # != 1 &] - 1; Array[f, 105] (* Robert G. Wilson v, Feb 07 2012 *)
|
|
PROG
|
(PARI) A003434(n)=for(k=0, n, n>1 || return(k); n=eulerphi(n)) /* Works because the loop limits are evaluated only once. Using while(...) takes 50% more time. */ \\ M. F. Hasler, Jul 01 2009
(Haskell)
a003434 n = fst $ until ((== 1) . snd)
(\(i, x) -> (i + 1, a000010 x)) (0, n)
(Python)
from sympy import totient
c, m = 0, n
while m > 1:
c += 1
m = totient(m)
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|