Skip to content

Commit

Permalink
Retos programación mouredev#21
Browse files Browse the repository at this point in the history
  • Loading branch information
camilitwo committed May 22, 2023
1 parent bf31250 commit 047c6a2
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

def esPrimo(num):
for i in range(2, num):
if num % i == 0:
return False
return True

def esGemelo(num1, num2):
if num1 - num2 == 2 or num2 - num1 == 2:
return True
return False

def main():
rango = int(input("Ingrese el rango: "))
for i in range(2, rango):
if esPrimo(i) and esPrimo(i + 2):
if(esGemelo(i, i + 2)):
print(f"({i}, {i + 2})")

if __name__ == "__main__":
main()

0 comments on commit 047c6a2

Please sign in to comment.