Skip to content

Instantly share code, notes, and snippets.

@djipko
Created February 10, 2012 22:16
Show Gist options
  • Save djipko/1793463 to your computer and use it in GitHub Desktop.
Save djipko/1793463 to your computer and use it in GitHub Desktop.
Solution to Embedly problem #1
from math import factorial
from operator import add
from itertools import count
def R(n):
return reduce(add, map(int, str(factorial(n))))
if __name__ == "__main__":
#Brute force works just fine on my makbook air so...
for n in count():
Rn = R(n)
if Rn == 8001:
print "The lowest number whose R is 8001 is %d" %n
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment