PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000250. Các số nguyên tố cùng nhau (Relatives)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Các số nguyên tố cùng nhau (Relatives)
Relatives
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , count positive integers with and .
Input
Read one integer .
Output
Print the count of integers coprime to ; print 0 for .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
7
Output
6
Explanation
There are 6 coprime integers below : 1, 2, 3, 4, 5, 6.
Example 2
Input
12
Output
4
Explanation
There are 4 coprime integers below : 1, 5, 7, 11.
Example 3
Input
1
Output
0
Explanation
There are 0 coprime integers below : .