public static void main(String args[]){
		

	        //Define Array holding all values of prime or not
	        boolean[] isPrime = new boolean[1001];
	        for (int i = 2; i <= 1000; i++) {
	            isPrime[i] = true;
	        }

	        //Mark anything that is not prime
	        for (int i = 2; i*i <= 1000; i++) {

	            //if i is prime, multiples are not
	            if (isPrime[i]) {
	                for (int j = i; i*j <= 1000; j++) {
	                    isPrime[i*j] = false;
	                }
	            }
	        }

	        //Output results
	        int count = 0;
	        for (int i = 2; i <= 1000; i++) {
	            if (isPrime[i]){
	            	count++;
	            	System.out.print(i + "\t");
	            	if (count%15==0){
	            		System.out.println("");
	            	}
	            }
	        }
	}