-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP7.java
More file actions
41 lines (41 loc) · 932 Bytes
/
P7.java
File metadata and controls
41 lines (41 loc) · 932 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
38
39
40
41
import java.util.*;
class P7
{
public static void main(String[] args)
{
int k=0;
int n=0;
LinkedList p=new LinkedList();
long i=2;
while(i<200000l && n!=10001)
{
int c=0;
for(long j=2;j<=(i/2);j++)
{
//System.out.println(i);
if(i%j==0)
{
c=1;
i++;
break;
}
}
//i++;
if(c==0)
{
//System.out.println(c);
//System.out.println(i);
//Integer i1=Integer.valueOf("i");
if(n<=10001)
{
p.add(i);
// System.out.println(p);
i++;
}
n++;
}
}
System.out.println(n);
System.out.println(p.getLast());
}
}