Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python is prime

from math import sqrt, floor;

def is_prime(num):
    if num < 2: return False;
    if num == 2: return True;
    if num % 2 == 0: return False;
    for i in range(3,floor(sqrt(num))+1,2):
        if num % i == 0: return False;
    return True;
Source by www.sanfoundry.com #
 
PREVIOUS NEXT
Tagged: #python #prime
ADD COMMENT
Topic
Name
1+2 =