Skip to content

Instantly share code, notes, and snippets.

@mike-huls
Created December 8, 2021 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mike-huls/5347b9e2cd339934857061db39d6abc9 to your computer and use it in GitHub Desktop.
Save mike-huls/5347b9e2cd339934857061db39d6abc9 to your computer and use it in GitHub Desktop.
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