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
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
David, I get 4187, 1152, 768, 512, 256, 128, 64, 32, 16, 8, 4, 2--or 12 for 4187.
@David, I'm getting 4817, 1440, 1152, 768, 512, 256, 128, 64, 32, 16, 8, 4, 2 (length 13) for n=4817.
You are correct. I thought I had verified separately before commenting.