I want to find all the prime number less then some given big integer number.
like
BigInteger n=new BigInteger(jTex tField1.getText ());
then all prime number less then n.
While I tried it was giving error the increment and comparison operator can not be applied to BigInt..
Any solution to this?
like
BigInteger n=new BigInteger(jTex tField1.getText ());
then all prime number less then n.
While I tried it was giving error the increment and comparison operator can not be applied to BigInt..
Code:
for (i=1;i<n; n.add(BigInteger.ONE)) // Error : -- and >= can not be applied to java.math.BigInteger
{
int ctr=0;
for(x =i; x>=1; x--) // Error : -- and >= can not be applied to java.math.BigInteger
{
if(i%x==0) //Error : % can not be applied to java.math.BigInteger
{
ctr = ctr + 1;
}
}
if (ctr ==2)
{
System.out.print(" " + i);
}
}
Comment