PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000245. Hàm phi Euler (Euler Totient Function)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Hàm phi Euler (Euler Totient Function)
Euler Totient Function
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Euler’s totient counts integers with and . Determine .
Input
Read one integer .
Output
Print one integer, .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
5
Output
4
Explanation
The integers coprime to are 1, 2, 3, 4, giving 4 values.
Example 2
Input
1
Output
1
Explanation
The integers coprime to are 1, giving 1 values.