Skip to content

Instantly share code, notes, and snippets.

@igoreliasm igoreliasm/primos.py
Last active Apr 4, 2016

Embed
What would you like to do?
100 primeiros numeros primos
#!/usr/bin/env python
#-*- coding: utf8-*-
not_p = []
e = []
lim = 100
def primo(num):
if num != 1:
t = True
for i in range(2,num):
if num % i == 0:
t = False
break
return t
for num in range(2, lim + 1):
test = primo(num)
if (test):
e.append(num)
else:
not_p.append(num)
print "Números primos: ", e
print "Não são primos: ", not_p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.