베르트와 공존(4948)
Last updated
Last updated
1
10
13
100
1000
10000
100000
01
4
3
21
135
1033
8392import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while(n!=0){
int count=0;
for(int i=n+1; i<=2*n; i++){
count+=getPrime(i);
}
System.out.println(count);
n = sc.nextInt();
}
}
public static int getPrime(int n){
if(n==0) return 0;
for(int i=2; i<=Math.sqrt(n); i++){
if(n%i==0)
return 0;
}
return 1;
}
}