Created
November 21, 2012 09:23
-
-
Save kimihito/4123955 to your computer and use it in GitHub Desktop.
return list of primes
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
| #!/usr/bin/env python | |
| # coding: utf-8 | |
| from math import * | |
| def prime(val): | |
| primes = [] | |
| for i in range(2,val): | |
| isPrime = True | |
| for j in range(2, int(floor(sqrt(i))) + 1): | |
| if i % j == 0: | |
| isPrime = False | |
| if isPrime: | |
| primes.append(i) | |
| return primes | |
| print prime(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment