Skip to content

Instantly share code, notes, and snippets.

@pschanely
Created April 10, 2024 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pschanely/dc06624172e0bcc529f8ee6226a09362 to your computer and use it in GitHub Desktop.
Save pschanely/dc06624172e0bcc529f8ee6226a09362 to your computer and use it in GitHub Desktop.
Shared via CrossHair Playground
def check_prime_number(number: int) -> bool:
"""
pre: number > 0
post: implies(forall([number % i != 0 for i in range(2, number)]) and number != 1, __return__)
"""
if number < 2:
return False
for i in range(2, number ** 0.5 + 1):
if number % i == 0:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment