P19793 [GeeksforGeeks] Euler totient function4604
普及-
题目描述

Find the Euler Totient Function (ETF) Φ(N) for an input N. ETF is the count of numbers in {1, 2, 3, …, N} that are relatively prime to N, i.e., the numbers whose GCD (Greatest Common Divisor) with N is 1.

Example 1:
Input:
N = 11
Output:
10
Explanation:
From 1 to 11,
1,2,3,4,5,6,7,8,9,10
are relatively prime to 11.
Example 2:
Input:
N = 16
Output:
8
Explanation:
From 1 to 16
1,3,5,7,9,11,13,15
are relatively prime
to 16.
Your Task:
You don't need to read input or print anything. Your task is to complete the function ETF() which takes one integer value N, as input parameter and return the value of Φ(N).

Expected Time Complexity: O(NLog N)
Expected Space Complexity: O(1)

Constraints:
1<=N<=10^{5}

输入格式

见题面

输出格式

见题面

样例输入
N = 11
样例输出
10