30 lines
441 B
Python
30 lines
441 B
Python
def ala(x):
|
|
tmp = 0
|
|
while x != 0:
|
|
tmp += x % 10
|
|
x /= 10
|
|
return tmp
|
|
|
|
def ist(x, i):
|
|
if i == 1:
|
|
return False
|
|
if x < 10:
|
|
return False
|
|
while x != 1:
|
|
if x % i != 0:
|
|
return False
|
|
x /= i
|
|
return True
|
|
|
|
n = 2
|
|
count = []
|
|
while n < 100:
|
|
for i in xrange(100):
|
|
tmp = n ** i
|
|
if ist(tmp, ala(tmp)):
|
|
if count.count(tmp) == 0:
|
|
count.append(tmp)
|
|
count.sort()
|
|
n += 1
|
|
print count[29]
|