You can download this code by clicking the button below.
This code is now available for download.
Determine whether a number is a prime number
Technology Stack : math, re
Code Type : Function
Code Difficulty : Intermediate
import math
import re
def is_prime_number(num):
if num <= 1:
return False
if num <= 3:
return True
if num % 2 == 0 or num % 3 == 0:
return False
i = 5
while i * i <= num:
if num % i == 0 or num % (i + 2) == 0:
return False
i += 6
return True