Created
July 14, 2012 18:43
-
-
Save FerPerales/3112626 to your computer and use it in GitHub Desktop.
Primer numbers
This file contains 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 primos(limite): | |
primos = [] | |
for elemento in range(2,limite): | |
encontrado = False | |
for primo in primos: | |
if elemento % primo == 0 and elemento is not primo: | |
encontrado = True | |
break | |
if not encontrado: | |
primos.append(elemento) | |
return primos | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A function that returns all the prime numbers between 0 and limite