You are viewing a single comment's thread. Return to all comments →
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String n = bufferedReader.readLine(); BigInteger number = new BigInteger(n); if (number.isProbablePrime(20)) { System.out.print("prime"); } else { System.out.print("not prime"); } bufferedReader.close(); } }
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 →