Last active
August 29, 2015 14:13
-
-
Save ttruty/eebe50e727974c6f581b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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