Skip to content

Instantly share code, notes, and snippets.

@gerep
Created Aug 31, 2017
Embed
What would you like to do?
def maior_primo(n):
cont = 1
maior = 0
while cont <= n:
if primo(cont):
if cont > maior:
maior = cont
cont += 1
return maior
def primo(n):
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5)+1, 2):
if n % x == 0:
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment