You are viewing a single comment's thread. Return to all comments →
When I changed the prime certainty value from 0 to 1 all of my test cases passed for the below code in Java 15.
import java.io.*; import java.math.BigInteger; public class JavaPrimalityTest { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String n = bufferedReader.readLine(); bufferedReader.close(); BigInteger num = new BigInteger(n); System.out.println(num.isProbablePrime(1) ? "prime" : "not prime"); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Primality Test
You are viewing a single comment's thread. Return to all comments →
When I changed the prime certainty value from 0 to 1 all of my test cases passed for the below code in Java 15.