Created
September 4, 2017 03:03
-
-
Save lumiobrie/f8c68c576f8ad89aab4804bfb40e61cb to your computer and use it in GitHub Desktop.
Programa que interactua con la librería mates.py para encontrar los n primeros números primos por encima de un número m que cumplan a su vez la condición de que la suma de sus dígitos sea también un número primo
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
from mates import * | |
solucion = [] | |
numTest = 1000000 # Límite inferior | |
totalQueCumplen = 2 # Cuántos encuentra que cumplan la condición | |
while len(solucion) < totalQueCumplen: | |
if esPrimo(numTest) and esPrimo(sumarDigitos(numTest)): | |
solucion.append(numTest) | |
numTest += 1 #Siguiente número a probar | |
print("Los números encontrados fueron:") | |
for elemento in solucion: | |
print(elemento) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment