public static void main ( String [] args ) {

	int range = 999999999;
	int i, num1, num2;
	int counter = 0;

	for ( num1=2; num1<=range; num1++ ) {
	    num2 = (int) Math.sqrt(num1);

	    for ( i=2; i<=num2; i++ ) {
		if ( num1%i ==0 ) {
		    break;
		}
	    }

	    if ( i==num2+1 ) {
		counter++;
	    }

	    if ( counter == 10001 ) {
		System.out.println("result = " + num1);
		break;
	    }

	}       
    }