The totient function counts numbers less than n that are relatively prime to n. The reduced totient function, or Carmichael lambda function, of n is the smallest positive number m such that
is congruent to 1 modulo n for all integers a that are coprime to n.
For example, the reduced totient of 6 is 2. The numbers less than and coprime to 6 are 1 and 5. All powers of 1 are congruent to 1 modulo 6. The smallest exponent m that works is 2 because
is 25, which is 1 modulo 6.
Write a function to compute the reduced totient.
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers2
Suggested Problems
-
2 Solvers
More from this Author328
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!