Skip to content

Instantly share code, notes, and snippets.

@josejuan
Created July 26, 2012 21:21
Show Gist options
  • Save josejuan/3184595 to your computer and use it in GitHub Desktop.
Save josejuan/3184595 to your computer and use it in GitHub Desktop.
Factoriones
# Factorial de 'n'
def factorial(n):
if n == 0:
return 1
return factorial(n - 1) * n
# Para cada número a revisar
for i in range(1, 2500000 + 1):
# Calculamos según la definición
j = sum([factorial(ord(j) - 48) for j in "%i" % i])
# Y si coincide
if i == j:
# ¡Es un factorión!
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment