/*

 * By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.

 * What is the 10 001st prime number?

 */


import java.math.BigInteger;


public class Problem7 {


boolean isPrime(BigInteger b) {

for (BigInteger i = new BigInteger("2"); i.compareTo(b) < 0; i = i.add(new BigInteger("1"))) {

if (b.mod(i).intValue() == 0) {

return false;

}

}

return true;

}


BigInteger primeCounter(int n) {

int counter = 0;

BigInteger i = new BigInteger("1");

while(counter < n) {

i = i.add(new BigInteger("1"));

if(isPrime(i)) {

counter++;

}

if(counter==n)

return i;

}

return null;

}


public static void main(String[] args) {

//104743

System.out.println(new Problem7().primeCounter(10001));

}

}