Created
October 5, 2016 12:02
-
-
Save jangeador/9ff077c8dd1238a26028d30cc4196dee to your computer and use it in GitHub Desktop.
rmotr.com assignment 1
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
| 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