Find prime k source code

จาก Paween Khoenkaw

private long findPrime(long x){

long i=3,c=0;

while(true)

{

if(isPrime(i)==true)

{

c++;

if(c==x)return i;

}

i++;

}

}


private boolean isPrime(long x){


for(long i=2;i<x;i++)

{

if((x%i)==0)

{

return false;

}

}

return true;

}