The number 81 has a special property, a certain power of the sum of its digits is equal to 81 (nine squared). Eighty one (81), is the first number in having this property (not considering numbers of one digit). 
The next one, is 512.
Let's see both cases with the details

8 + 1 = 9 and 9^(2) = 81

512 = 5 + 1 + 2 = 8 and 8^(3) = 512

We need to make a function, ```power_sumDigTerm()```, that receives a number ```n``` and may output the ```n-th term``` of this sequence of numbers.
The cases we presented above means that

power_sumDigTerm(1) == 81

power_sumDigTerm(2) == 512


Happy coding!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Sorting

Data structures

Mathematics

Starter code: def power_sumDigTerm(n):
	

Solutions:
series = [0]
for a in range(2, 99):
	for b in range(2, 42):
		c = a ** b
		if a == sum(map(int, str(c))):
			series.append(c)
power_sumDigTerm = sorted(series).__getitem__


def dig_sum(n):
	return sum(map(int, str(n)))
terms = []
for b in range(2, 400):
	for p in range(2, 50):
		if dig_sum(b ** p) == b:
			terms.append(b ** p)
terms.sort()

def power_sumDigTerm(n):
	return terms[n - 1]


power_sumDigTerm = [None, 81, 512, 2401, 4913, 5832, 17576, 19683, 234256, 390625, 614656, 1679616, 17210368, 34012224, 52521875, 60466176, 205962976, 612220032, 8303765625, 10460353203, 24794911296, 27512614111, 52523350144, 68719476736, 271818611107, 1174711139837, 2207984167552, 6722988818432, 20047612231936, 72301961339136, 248155780267521, 3904305912313344, 45848500718449031, 81920000000000000, 150094635296999121, 13744803133596058624, 19687440434072265625, 53861511409489970176, 73742412689492826049, 179084769654285362176, 480682838924478847449].__getitem__


def power_sumDigTerm(n):
	return sorted([i ** j for j in range(2, 50) for i in range(2, 100) if i == sum([int(i) for i in str(i ** j)])])[n - 1]


def power_sumDigTerm(n):
	return [81, 512, 2401, 4913, 5832, 17576, 19683, "I'm never tested :(", 390625, 614656, 1679616, 17210368, 34012224, 52521875, 60466176, 205962976, 612220032, 8303765625, 10460353203, 24794911296, 27512614111, 52523350144, 68719476736, 271818611107, 1174711139837, 2207984167552, 6722988818432, 20047612231936, 72301961339136, 248155780267521, 3904305912313344, 45848500718449031, 81920000000000000, 150094635296999121, 13744803133596058624, 19687440434072265625, 53861511409489970176, 73742412689492826049, 39, 40][n - 1]


def power_sumDigTerm(n):

	def sum_d(x):
		L = [int(d) for d in str(x)]
		res = 0
		for l in L:
			res = res + l
		return res
	r_list = []
	for j in range(2, 50):
		for i in range(7, 100):
			a = i ** j
			if sum_d(a) == i:
				r_list.append(a)
				r_list = list(set(r_list))
	r_list = sorted(r_list)
	return r_list[n - 1]


def power_sumDigTerm(n):
	my_list = []
	for number in range(2, 100):
		for exponent in range(2, 50):
			raised_number = number ** exponent
			sum_of_digits = 0
			for digit in list(str(raised_number)):
				sum_of_digits += int(digit)
			if sum_of_digits ** exponent == raised_number:
				my_list.append(raised_number)
	answer = sorted(my_list)
	return answer[n - 1]


def power_sumDigTerm(n):
	return sorted([a ** b for a in range(2, 100) for b in range(2, 100) if a == sum(map(int, str(a ** b)))])[n - 1]