Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/com/thealgorithms/maths/Prime/PrimeCheck.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.thealgorithms.maths.Prime;

import java.math.BigInteger;
import java.util.Scanner;

public final class PrimeCheck {
Expand All @@ -22,6 +23,12 @@ public static void main(String[] args) {
} else {
System.out.println("algo2 verify that " + n + " is not a prime number");
}

if (BigInteger.valueOf(n).isProbablePrime(100)){ // uses Miller–Rabin and Lucas probable prime test (Baillie–PSW)
System.out.println("algo3 verify that " + n + " is a prime number");
} else {
System.out.println("algo3 verify that " + n + " is not a prime number");
}
scanner.close();
}

Expand Down
Loading