Dsa
Math
Medium
Euler's Totient Function
Write a function that calculates the Euler's Totient function for a given integer n. The value of the function φ(n) is the number of integers up to n that are coprime to n. The input will be a single integer.
Example:
Input:
9
Output:
6
Key concepts
mathnumber-theorytotient
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now