For this Question: Sara has developed a new algorithm to find sprime : 

For an integer n , To find all the sprime between 1 and n ,  she will start from the end n , mark it as sprime, and then mark all its factors (excluding itself) as not sprime. Then she will find the next greatest unmarked number less than the current sprime number , mark it as sprime, and mark all its factors (excluding itself) as not sprime. She will continue this process till all the numbers between 1 and n has been marked either sprime or not sprime . 

Your task is to calculate the the number of sprimes that are also prime between 1 and n.The first line contains T the number of test cases. 
Each of the next T lines contain an integer n.

Constraint:-
1 <= T <= 100
2 <= n <= 10000000Output T lines, one for each test case, containing the required answer.Sample Input :
3
2
4
7

Sample Output :
1
1
2

Explanation:-
For test 3:- 7 and 5 are the required primes 

, I have written this Solution Code: import java.io.*;
import java.util.*;

class Main {

	public static void sieve(boolean prime[], int n) {
		int i,j;
		for(i = 0; i <= n; i++)
			prime[i] = true;

		for(i = 2; i*i <= n; i++)
			if(prime[i])
				for(j = i*i; j<=n; j+=i)
					prime[j] = false;
	}
	public static void main (String[] args) throws IOException {

		int num = 10000005;
		boolean prime[] = new boolean[num+1];

		sieve(prime, num);

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int T = Integer.parseInt(br.readLine().trim());

		while(T --> 0) {
			int n = Integer.parseInt(br.readLine().trim());
			int count = 0;

			for(int i=(n/2)+1; i<=n; i++)
				if(prime[i])
					count++;

			System.out.println(count);
		}
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?