Skip to content

Instantly share code, notes, and snippets.

@ttruty
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save ttruty/eebe50e727974c6f581b to your computer and use it in GitHub Desktop.

Select an option

Save ttruty/eebe50e727974c6f581b to your computer and use it in GitHub Desktop.
# Test if a number is prime
def is_prime(x):
for n in range(2, x - 1):
if x % n == 0:
return False
else:
return True
# test # print is_prime(17)
# find the next prime number
def find_next_prime(x):
while is_prime(x) == False:
x += 1
else:
return x
print find_next_prime(6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment