A **pandigital number** is one that has its digits from ```1``` to ```9``` occuring only once (they do not have the digit 0).

The number ```169```, is the first pandigital square, higher than ```100```, having its square root, ```13```, pandigital too.

The number ```1728``` is the first pandigital cubic, higher than ```1000```, having its cubic root, ```12```, pandigital too.

Make the function ```pow_root_pandigit()```, that receives three arguments:

- a minimum number, ```val```

- the exponent of the n-perfect powers to search, ```n```

- ```k```, maximum amount of terms that we want in the output

The function should output a 2D-array with an amount of k pairs of numbers(or an array of an only pair if we have this case). Each pair has a nth-perfect power pandigital higher than val with its respective nth-root that is pandigital, too.

The function should work in this way:
```python
pow_root_pandigit(val, n, k) = [[root1, pow1], [root2, pow2], ...., [rootk, powk]]
"""
root1 < root2 <.....< rootk
val < pow1 < pow2 < ....< powk
root1 ^ n = pow1 // root2 ^ n = pow2 //........// rootk ^ n = powk
all pairs rooti, powi are pandigitals
"""
```
Let's see some examples:
```python
pow_root_pandigit(388, 2, 3)== [[23, 529], [24, 576], [25, 625]] # 3 pairs (k = 3)
```
For a different power:
```python
pow_root_pandigit(1750, 3, 5) == [[13, 2197], [17, 4913], [18, 5832], [19, 6859], [21, 9261]] # 5 pairs (k = 5)
```

The output in not inclusive for val.
```python
pow_root_pandigit(1728, 3, 4) == [[13, 2197], [17, 4913], [18, 5832], [19, 6859]]
# ∛1728 = 12
```

The result may have less terms than the required:
```python
pow_root_pandigit(600000000, 2, 5) == [25941, 672935481] # If the result has an only one pair, the output is an array
```
Furthermore, if the minimum value, ```val``` is high enough, the result may be an empty list:
```python
pow_root_pandigit(900000000, 2, 5) == []
```

You may suposse that the input ```val```, ```n``` will be always:  ```val > 10``` and ```n > 2```.

Enjoy it!!

Difficulty: EASY
Starter code: def pow_root_pandigit(val, n, k):
	

Solutions:
def is_pandigital(n):
	s = str(n)
	return not '0' in s and len(set(s)) == len(s)

def pow_root_pandigit(val, n, k):
	res = []
	current = int(round(val ** (1.0 / n), 5)) + 1
	while len(res) < k and current <= 987654321 ** (1.0 / n):
		if is_pandigital(current):
			p = current ** n
			if is_pandigital(p):
				res += [[current, p]]
		current += 1
	return res if len(res) != 1 else res[0]


def is_pandigital(n):
	s = set((c for c in str(n) if c != '0'))
	if len(s) != len(str(n)):
		return False
	else:
		return True

def pow_root_pandigit(val, n, k):
	(i, l) = (int(val ** (1.0 / n)) - 1, [])
	while len(l) < k:
		if i ** n > val and is_pandigital(i) and is_pandigital(i ** n):
			l.append([i, i ** n])
		i += 1
		if i ** n > 987654321:
			break
	if len(l) == 1:
		return l[0]
	else:
		return l


def pow_root_pandigit(v, n, k):
	(r, i) = ([], int(v ** (1.0 / n)))
	while len(r) < k and i < 25942:
		i += 1
		s = str(i)
		if '0' not in s and len(s) == len(set(s)):
			j = i ** n
			if j <= v:
				continue
			t = str(j)
			if '0' not in t and len(t) == len(set(t)):
				r += [[i, j]]
	return [] if not r else r if len(r) > 1 else r[0]


from itertools import permutations as p
n_str = '123456789'
formt = lambda n: sorted(list(map(''.join, list(filter(set, p(n_str, n))))))
db = formt(1) + formt(2) + formt(3) + formt(4) + formt(5)
hs = {1: 0, 2: 9, 3: 81, 4: 585, 5: 3609}

def next_pandigital(lp):
	if lp in db:
		return db[db.index(lp):]
	while 1:
		lp = str(int(lp) + 1)
		if lp in db[hs[len(lp)]:]:
			break
	return db[db.index(lp):]

def is_pandigital(lp):
	return len(set(lp)) == len(lp) and '0' not in lp

def pow_root_pandigit(val, n, k):
	l = []
	low = int(val ** (1 / n) + 0.0001) + 1
	for p in next_pandigital(str(low)):
		v = int(p) ** n
		if is_pandigital(str(v)):
			l.append([int(p), v])
		if len(l) == k:
			return l
	return l[0] if len(l) == 1 else l


import math

def is_pandigit(val):
	val = str(val)
	return '0' not in val and len(val) == len(set(val))

def pow_root_pandigit(val, n, k):
	result = []
	rt = math.ceil((val + 1) ** (1 / n))
	for r in range(rt, math.ceil(10 ** (9 / n))):
		if is_pandigit(r):
			x = r ** n
			if is_pandigit(x):
				result.append([r, x])
				if len(result) == k:
					break
	return result if len(result) != 1 else result[0]


from math import *

def pow_root_pandigit(val, n, k):
	l = []
	if val < 0:
		val = 0
	if val > 987654321:
		return l
	r = 1.0 / n
	for i in range(int(ceil((val + 1) ** r)), int(987654322 ** r)):
		string = str(i ** n)
		if len(set(string)) == len(string) and '0' not in string and ('0' not in str(i)) and (len(set(str(i))) == len(str(i))):
			l.append([i, int(string)])
		if len(l) == k:
			break
	if len(l) == 1:
		l = l[0]
	return l