forked from CS816SPE/Learning_Git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput3.java
More file actions
46 lines (44 loc) · 1.11 KB
/
input3.java
File metadata and controls
46 lines (44 loc) · 1.11 KB
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
38
39
40
41
42
43
44
45
46
import java.io.File;
import java.util.*;
import java.util.HashMap;
import java.util.Map;
import java.io.*;
class Input3{
public static void main(String ar[]) throws Exception{
// File file=new File("/home/naman/java_jobs/input3.txt");
// Scanner sc = new Scanner(file);
// int i = 0;
Scanner sc = new Scanner(System.in);
int m = sc.nextInt();
period(m);
/* try{
while (sc.hasNext()) {
int line = sc.nextInt();
al.add(line);
i++;
}
Collections.sort(al);
int j=(al.size())-1;
for (int k = 0; k < 10; k++) {
System.out.println(al.get(k));
}
}
catch(Exception e){
}*/
}
public static void period(int m){
int c=1;
int d,e;
int i = 0;
d = (c * c + 5 * c + 6) % m;
c = d;
do{
// d= (c*c+5*c+6)%m;
e=(c*c+5*c+6)%m;
c=e;
i++;
System.out.print(" "+e);
} while ((e != 12));
System.out.println(i);
}
}