Skip to content

Instantly share code, notes, and snippets.

@shoukreytom
Created August 31, 2019 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoukreytom/d6bde5c0f99d4b999847a496e88c2ef6 to your computer and use it in GitHub Desktop.
Save shoukreytom/d6bde5c0f99d4b999847a496e88c2ef6 to your computer and use it in GitHub Desktop.
checks if a number given is prime number or not
import java.math.BigInteger;
import java.util.Scanner;
public class Check {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
BigInteger n = scan.nextBigInteger();
scan.close();
System.out.println(n.isProbablePrime(10) ? "prime" : "not prime");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment