In mathematics, a **pandigital number** is a number that in a given base has among its significant digits each digit used in the base at least once. For example, 1234567890 is a pandigital number in base 10.

For simplification, in this kata, we will consider pandigital numbers in *base 10* and with all digits used *exactly once*. The challenge is to calculate a sorted sequence of pandigital numbers, starting at a certain `offset` and with a specified `size`.

Example:
```python
  > get_sequence(0, 5)
  [1023456789, 1023456798, 1023456879, 1023456897, 1023456978]
```

Rules:
- We are looking for positive pandigital numbers in base 10.
- Each digit should occur `exactly once`.
- A pandigital number can't start with digit zero.
- The offset is an integer (negative, zero or positive number) (long in Java)
- The size is a positive integer number (int in Java)
- Return the `size` pandigital numbers which are not smaller than the `offset`. If there is not enough `size` pandigital numbers, just return all of them.
- Return an empty array if nothing is found.

Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code:
def get_sequence(offset, size):
	

Solutions:
def get_sequence(o, s, st=1023456789):
	li = []
	for i in range([st, o][o > 0 and o > st], 9876543211):
		i = str(i)
		if i[0] != '0' and len(set(i)) == 10:
			li.append(int(i))
		if len(li) == s:
			break
	return li


from itertools import permutations
from bisect import bisect_left
memo = [int(''.join(x)) for x in permutations('0123456789') if x[0] != '0']

def get_sequence(offset, size):
	i = bisect_left(memo, offset)
	return memo[i:i + size]


pandigital = [int(''.join(p)) for p in __import__('itertools').permutations('0123456789')][2 * 3 * 4 * 5 * 6 * 7 * 8 * 9:]
get_sequence = lambda offset, size: (lambda idx: pandigital[idx:idx + size])(__import__('bisect').bisect_left(pandigital, offset))


def is_pand(n):
	return len(set(list(str(n)))) == len(str(n))

def next_pan(n):
	while True:
		if is_pand(n):
			yield n
		n += 1

def get_sequence(n, k):
	if n < 1023456789:
		n = 1023456789
	elif n >= 9999999999:
		return []
	if not is_pand(n):
		n = next(next_pan(n))
	res = []
	for i in next_pan(n):
		res.append(i)
		if len(res) == k:
			break
	return res


def get_sequence(offset, size):
	(i, re) = (1023456789 if offset < 1023456789 else offset, [])
	while i <= 9876543210 and len(re) < size:
		if sorted('0123456789') == sorted(str(i)):
			re.append(i)
		i += 1
	return re


END = 9876543211

def get_sequence(offset, size):
	number = 1023456789
	sequence = []
	if offset < number:
		offset = number
	for element in range(offset, END):
		if check_number(element):
			sequence.append(element)
		if len(sequence) == size:
			break
	return sequence

def check_number(number):
	seq = set(str(number))
	return len(seq) == 10


def get_sequence(offset, size):
	out = []
	if offset < 1023456789:
		offset = 1023456789
	while len(out) < size and offset < 9876543211:
		if sorted(str(offset)) == ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
			out.append(offset)
		offset += 1
	return out


def get_sequence(offset, size):
	result = []
	if offset < 1023456789:
		offset = 1023456789
	while len(result) < size and offset < 10000000000:
		if len(set(str(offset))) == 10:
			result.append(offset)
		offset += 1
	return result


def get_sequence(offset, size):
	num = max(offset, 1023456789)
	digits = set('0123456789')
	ret = []
	for _ in range(size):
		while num < 9876543210:
			if set(str(num)) == digits:
				ret.append(num)
				break
			else:
				num += 1
		num += 1
	return ret


from itertools import permutations as perms

def is_pand(n):
	return len(set(list(str(n)))) == len(str(n))

def next_pan(n):
	while True:
		if is_pand(n):
			yield n
		n += 1

def get_sequence(n, k):
	if n < 1023456789:
		n = 1023456789
	elif n >= 9999999999:
		return []
	if not is_pand(n):
		n = next(next_pan(n))
	res = []
	for i in next_pan(n):
		res.append(i)
		if len(res) == k:
			break
	return res