Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for The Best Number Ever by johan4622
"""
[The Best Number Ever](https://py.checkio.org/en/mission/the-best-number-ever/)
"""
def checkio() -> int:
"""
return 7
Parameters
----------
NONE
Returns
-------
result : int
return 7. 7 is the Mersenne prime.
NOTE
----
See Wikipedia page [Mersenne prime](https://en.wikipedia.org/wiki/Mersenne_prime).
"""
return 7 # 7 is the Mersenne prime.
def is_prime(num: int)->bool:
"""
naive check for prime number.
Parameters
----------
- num: int
candidate for prime number.
Reteruns
--------
- result : bool
check result. True means that num is prime number.
"""
for i in range(2, num):
if num % i == 0:
return False
return True
if __name__ == '__main__':
assert checkio(), 2 ** 3 - 1 # 7 is a Mersenne number.
assert is_prime(checkio()), True # 7 is also a prime number.
Aug. 19, 2019
Comments: