How to detect prime number using this package? #479
-
Is there any function to do this? use MathPHP\NumberTheory\Integer;
Integer::isPrime(5);
Integer::isPrime(2910);
Integer::isPrime(2832981); |
Beta Was this translation helpful? Give feedback.
Answered by
markrogoyski
Apr 17, 2024
Replies: 2 comments 1 reply
-
count(Integer::primeFactorization(5)) == 1 // True
count(Integer::primeFactorization(2910)) == 1 // False
count(Integer::primeFactorization(2832981)) == 1 // ?? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I've implemented |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lamualfa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've implemented
NumberTheory\Integer::isPrime($n)
in the latest version v2.10.0. Thank you @lamualfa for the suggestion, and @Beakerboy for the temporary workaround suggestion.