The number ```89``` is the first integer with more than one digit that fulfills the property partially introduced in the title of this kata. 
What's the use of saying "Eureka"? Because this sum gives the same number.

In effect: ```89 = 8^1 + 9^2``` 

The next number in having this property is ```135```.

See this property again: ```135 = 1^1 + 3^2 + 5^3```

We need a function to collect these numbers, that may receive two integers ```a```, ```b``` that defines the range ```[a, b]``` (inclusive) and outputs a list of the sorted numbers in the range that fulfills the property described above.

Let's see some cases:
```python
sum_dig_pow(1, 10) == [1, 2, 3, 4, 5, 6, 7, 8, 9]

sum_dig_pow(1, 100) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 89]
```
If there are no numbers of this kind in the range [a, b] the function should output an empty list.
```python
sum_dig_pow(90, 100) == []
```
Enjoy it!!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def sum_dig_pow(a, b):
	

Solutions:
def dig_pow(n):
	return sum((int(x) ** y for (y, x) in enumerate(str(n), 1)))

def sum_dig_pow(a, b):
	return [x for x in range(a, b + 1) if x == dig_pow(x)]


def sum_dig_pow(a, b):
	return [x for x in range(a, b + 1) if sum((int(d) ** i for (i, d) in enumerate(str(x), 1))) == x]


def sum_dig_pow(a, b):
	res = []
	for number in range(a, b + 1):
		digits = [int(i) for i in str(number)]
		s = 0
		for (idx, val) in enumerate(digits):
			s += val ** (idx + 1)
		if s == number:
			res.append(number)
	return res


def sum_dig_pow(a, b):
	l = []
	for i in range(a, b + 1):
		k = 0
		p = str(i)
		for j in range(len(p)):
			k += int(p[j]) ** (j + 1)
		if k == i:
			l.append(i)
	return l


def sum_dig_pow(a, b):
	ans = []
	while a <= b:
		if sum((int(j) ** k for (j, k) in zip(str(a), range(1, len(str(a)) + 1)))) == a:
			ans += [a]
		a += 1
	return ans


def sum_dig_pow(a, b):
	lis = []
	for i in range(a, b + 1):
		temp = str(i)
		su = 0
		for l in range(0, len(temp)):
			su += int(temp[l:l + 1]) ** (l + 1)
		if su == i:
			lis.append(i)
	return lis