get prime number python
from num_tool import is_prime
print(is_prime(3))
#returns True because 3 is a prime
get prime number python
from num_tool import is_prime
print(is_prime(3))
#returns True because 3 is a prime
check for prime in python
def is_prime(n: int) -> bool:
"""Primality test using 6k+-1 optimization."""
import math
if n <= 3:
return n > 1
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i <= math.sqrt(n):
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us