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 a^m 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 5^2 is 25, which is 1 modulo 6.
Write a function to compute the reduced totient.

Solution Stats

1 Solutions

1 Solvers

Last Solution submitted on Jul 02, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers1

Suggested Problems

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!