Skip to content

Instantly share code, notes, and snippets.

@jangeador
Created October 5, 2016 12:02
Show Gist options
  • Select an option

  • Save jangeador/9ff077c8dd1238a26028d30cc4196dee to your computer and use it in GitHub Desktop.

Select an option

Save jangeador/9ff077c8dd1238a26028d30cc4196dee to your computer and use it in GitHub Desktop.
rmotr.com assignment 1
def find_next_prime(n):
'''
>>> find_next_prime(6)
7
>>> find_next_prime(10)
11
>>> find_next_prime(11)
13
'''
def is_prime(p):
for i in range(2, p - 1):
if p % i == 0:
return False
return True
j = n
while True:
j += 1
if is_prime(j):
return j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment