public static void main(String args[]) {
		long startT = System.currentTimeMillis();
		//assume all are prime
		for(int i = 2; i < isPrime.length; i++)
			isPrime[i] = true;
		setIsPrime();
		
		for(int i = 1000; i < 10000; i++)
			if(isPrime[i])
				for(int j = i+1; j < 10000; j++)
					if( isPrime[j] && isPerm(i, j) ) {
						int k = j+(j-i);
							if( k < isPrime.length && isPrime[k] && isPerm(j, k) )
								System.out.printf("%5d%5d%5d\n", i, j, k);
					}
							
		long endT = System.currentTimeMillis();
		System.out.println((int)(endT-startT));
	}