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

3 Solutions

3 Solvers

Last Solution submitted on Jul 03, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...