Problem 61053. Determine when iterations of phi(psi(x)) repeat
Cody Problem 656 introduced the Euler totient function
, which counts the number of integers smaller than x
that are relatively prime to x--that is, that share no common factors with x other than 1. Its definition implies that
. Cody Problem 61052 deals with the Dedekind psi function
, which is always greater than x.
What happens if the function
is applied repeatedly? If
, then
and
. The next iteration gives
and
. The third iteration gives
and
. After this step—i.e., after three iterations, the results will repeat.
Write a function to determine the number of iterations after which
repeats. In other words, determine the step at which
.
Solution Stats
Problem Comments
-
3 Comments
ChrisR
on 26 Oct 2025 at 15:37
David, I get 4187, 1152, 768, 512, 256, 128, 64, 32, 16, 8, 4, 2--or 12 for 4187.
Christian Schröder
13 hours and 38 minutes ago
@David, I'm getting 4817, 1440, 1152, 768, 512, 256, 128, 64, 32, 16, 8, 4, 2 (length 13) for n=4817.
David Hill
8 hours and 47 minutes ago
You are correct. I thought I had verified separately before commenting.
Solution Comments
Show commentsProblem Recent Solvers2
Suggested Problems
More from this Author314
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!