Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def digit_sum(n):
- return sum(int(x) for x in str(n))
- j=100
- k=1
- res = []
- while j<1000:
- k=1
- x = digit_sum(j)
- while j >= x**k:
- k+=1
- if j == x**k:
- res.append(j**k)
- j+=1
- print res
- print digit_sum(512)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement