fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone {
  9. static
  10. int l(int n){int k=1,x,a,b,t,d=1;for(;d>0;)for(d=x=0;++x<n;d=a<2&t>1?k++:d){for(a=x,b=n;b>0;b=a%b,a=t)t=b;for(t=b=1;b++<=k;t=t*x%n);}return k;}
  11. public static void main (String[] args) throws java.lang.Exception {
  12. for( int i = 1; i < 100; i++ ) {
  13. System.out.print( i );
  14. System.out.println( " " + l(i) );
  15. }
  16. }
  17. }
Success #stdin #stdout 0.06s 320576KB
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