maths.next_prime_number¶
Next Prime Number – https://en.wikipedia.org/wiki/Prime_number
In the ancient city of Numeria, legends speak of an oracle whose whispers could bend the very fabric of mathematics. Travelers from distant lands would bring her a number, and in return, she would reveal its future: the very next prime number. Your task is to embody the oracle’s wisdom. You will be given a number. You must find the smallest prime number that is strictly greater than it.
Attributes¶
Functions¶
|
Check if a number is prime. |
|
Find the smallest prime number strictly greater than the given number. |
Module Contents¶
- maths.next_prime_number.is_prime(number: int) bool¶
Check if a number is prime.
>>> is_prime(2) True >>> is_prime(15) False >>> is_prime(19) True >>> is_prime(1) False >>> is_prime(-7) False
- maths.next_prime_number.next_prime(number: int) int¶
Find the smallest prime number strictly greater than the given number.
>>> next_prime(2) 3 >>> next_prime(7) 11 >>> next_prime(14) 17 >>> next_prime(0) 2 >>> next_prime(-10) 2
- maths.next_prime_number.n¶