-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10179.cpp
More file actions
37 lines (35 loc) · 809 Bytes
/
10179.cpp
File metadata and controls
37 lines (35 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
#define inf HUGE_VAL
#define mem(a, b) memset(a, b, sizeof(a))
int phi(int n) {
int res = n;
int i;
for (i = 2; i * i <= n; i++) {
if (!(n % i)) res -= res / i;
while (!(n % i)) n /= i;
if (n == 1) break;
}
if (n > 1) res -= res / n;
return res;
}
int main() {
int tc, t = 1;
int i, j, k, l, x;
// scanf("%d",&tc);
while (~scanf("%d", &k)) {
if (k == 0) return 0;
k = phi(k);
printf("%d\n", k);
}
return 0;
}