Example #1
0
#!/usr/bin/python

from eulerlib import factorial
from eulerlib import num2List

answerL = []
facts = {}
for ii in range( 0, 10 ):
   facts[ii] = factorial( ii )

for ii in range( 3, 999999 ):
   s = 0
   iiL = num2List(ii)
   for kk in iiL:
      s += facts[kk]

   if s == ii:
      answerL.append( s )

print sum( answerL )
Example #2
0
#!/usr/bin/python

from eulerlib import num2List

finalSum = 0

for ii in xrange(2, 1000000):
    cumulativeSum = 0
    l = num2List(ii)
    for kk in l:
        cumulativeSum = cumulativeSum + kk ** 5

    if cumulativeSum == ii:
        finalSum = finalSum + cumulativeSum

print finalSum