Created
October 4, 2016 20:12
-
-
Save glad1couldkek/6c21273cfc578e934505d987bbe9a1ac 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
| 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