Return phi(n), the number of integers k with 1 <= k <= n and gcd(k, n) = 1 (numbers that share no prime factor with n).
For n = 12 the answer is 4 (1, 5, 7, 11).
The starter code computes a gcd for every number up to n. It is correct but far too slow for large n.
Example 1
Input:
euler_phi(12)
Output:
4
Example 2
Input:
euler_phi(1)
Output:
1
1 <= n <= 10**12No results yet
Run your code to check it against the examples, or submit to run every test.