Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cpdef int evalcount(int range_from, int range_til):
""" Returns the number of evaluations that need to be performed when finding prime numbers in the given range range"""
cdef int evalcount = 0
cdef int num
cdef int candidate_prime
for num in range(range_from, range_til + 1):
if (num > 1):
for divnum in range(2, num):
evalcount += 1
if ((num % divnum) == 0):
break
return evalcount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment