fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. auto l =
  7. [](int n){int k=1,x,a,b,t,d=1;for(;d;)for(d=x=0;++x<n;d=a<2&t>1?k++:d){for(a=x,b=n;t=b;a=t)b=a%b;for(t=1,b=k;b--;t=t*x%n);}return k;};
  8. for( int i = 1; i < 100; i++ ) {
  9. std::cout<<i<<' '<<l(i)<<'\n';
  10. }
  11. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
1 1
2 1
3 2
4 2
5 4
6 2
7 6
8 2
9 6
10 4
11 10
12 2
13 12
14 6
15 4
16 4
17 16
18 6
19 18
20 4
21 6
22 10
23 22
24 2
25 20
26 12
27 18
28 6
29 28
30 4
31 30
32 8
33 10
34 16
35 12
36 6
37 36
38 18
39 12
40 4
41 40
42 6
43 42
44 10
45 12
46 22
47 46
48 4
49 42
50 20
51 16
52 12
53 52
54 18
55 20
56 6
57 18
58 28
59 58
60 4
61 60
62 30
63 6
64 16
65 12
66 10
67 66
68 16
69 22
70 12
71 70
72 6
73 72
74 36
75 20
76 18
77 30
78 12
79 78
80 4
81 54
82 40
83 82
84 6
85 16
86 42
87 28
88 10
89 88
90 12
91 12
92 22
93 30
94 46
95 36
96 8
97 96
98 42
99 30