Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

primes python

import math

def main():
    count = 3
    
    while True:
        isprime = True
        
        for x in range(2, int(math.sqrt(count) + 1)):
            if count % x == 0: 
                isprime = False
                break
        
        if isprime:
            print count
        
        count += 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #primes #python
ADD COMMENT
Topic
Name
2+2 =