Difficulty | Max Score | Success Ratio |
---|---|---|
Easy | 20 | 91.03% |
A prime number is a natural number greater than [SVG image] whose only positive divisors are [SVG image] and itself. For example, the first six prime numbers are [SVG image] , [SVG image] , [SVG image] , [SVG image] , [SVG image] , and [SVG image] .
Given a large integer, [SVG image] , use the Java BigInteger class' isProbablePrime method to determine and print whether it's prime
or not prime
.
Input Format
A single line containing an integer, [SVG image] (the number to be checked).
Constraints
- [SVG image] contains at most [SVG image] digits. Output Format
If [SVG image] is a prime number, print prime
; otherwise, print not prime
.
Sample Input
13
Sample Output
prime
Explanation
The only positive divisors of [SVG image] are [SVG image] and [SVG image] , so we print prime
.
View Solution : Java Primality Test
Submissions | Leaderboard | Discussions | Editorial |
---|---|---|---|
📝 My Submission | 🏆 Track our position | 🤔 Help from Community | ✍️ Editorial |