Skip to content

Instantly share code, notes, and snippets.

@glad1couldkek
Created October 4, 2016 20:12
Show Gist options
  • Select an option

  • Save glad1couldkek/6c21273cfc578e934505d987bbe9a1ac to your computer and use it in GitHub Desktop.

Select an option

Save glad1couldkek/6c21273cfc578e934505d987bbe9a1ac to your computer and use it in GitHub Desktop.
def find_next_prime(n):
prime = [x for x in range(1, n + 1) if n % x == 0]
if len(prime) == 2:
n += 1
while True:
prime = [x for x in range(1, n + 1) if n % x == 0]
if len(prime) > 2:
n += 1
continue
else:
return n
print(find_next_prime(6))
print(find_next_prime(10))
print(find_next_prime(11))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment