You will receive an uncertain amount of integers in a certain order ```k1, k2, ..., kn```.

You form a new number of n digits in the following way:
you take one of the possible digits of the first given number, ```k1```, then the same with the given number ```k2```, repeating the same process up to ```kn``` and you concatenate these obtained digits(in the order that were taken) obtaining the new number. As you can see, we have many possibilities.

Let's see the process above explained with three given numbers:
```
k1 = 23, k2 = 17, k3 = 89
Digits Combinations   Obtained Number
  ('2', '1', '8')           218    <---- Minimum
  ('2', '1', '9')           219
  ('2', '7', '8')           278
  ('2', '7', '9')           279
  ('3', '1', '8')           318
  ('3', '1', '9')           319
  ('3', '7', '8')           378
  ('3', '7', '9')           379    <---- Maximum
             Total Sum =   2388   (8 different values)
```
We need the function that may work in this way:

```python
proc_seq(23, 17, 89) == [8, 218, 379, 2388]
```

See this special case and deduce how the function should handle the cases which have many repetitions.

```python
proc_seq(22, 22, 22, 22) == [1, 2222] # we have only one obtained number, the minimum, maximum and total sum coincide
```

The sequence of numbers will have numbers of n digits only. Numbers formed by leading zeroes will be discarded.

```python
proc_seq(230, 15, 8) == [4, 218, 358, 1152]
```

Enjoy it!!

You will never receive the number 0 and all the numbers will be in valid format.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Mathematics

Starter code: def proc_seq(*args):
	

Solutions:
from itertools import product

def proc_seq(*args):
	nums = set((int(''.join(l)) for l in product(*(str(a) for a in args)) if l[0] != '0'))
	if len(nums) == 1:
		return [1, nums.pop()]
	return [len(nums), min(nums), max(nums), sum(nums)]


from itertools import product

def proc_seq(*args):
	p = set([int(''.join(e)) for e in product(*[[c for c in str(arg) if i or c != '0'] for (i, arg) in enumerate(args)])])
	return [len(p)] + ([min(p), max(p)] if len(p) > 1 else []) + [sum(p)]


def proc_seq(*li):
	un = {(i,) for i in str(li[0]) if i[0] != '0'}
	for i in li[1:]:
		un = {k + (l,) for k in un for l in str(i)}
	un = {int(''.join(i)) for i in un}
	return [1, un.pop()] if len(un) == 1 else [len(un), min(un), max(un), sum(un)]


from itertools import product

def proc_seq(*li):
	un = {int(''.join(i)) for i in list(product(*map(str, li))) if i[0] != '0'}
	return [1, un.pop()] if len(un) == 1 else [len(un), min(un), max(un), sum(un)]


from itertools import product

def proc_seq(*args):
	res = [int(''.join(s)) for s in set(product(*map(str, args))) if s[0] != '0']
	if len(res) == 1:
		return [1, res[0]]
	return [len(res), min(res), max(res), sum(res)]


def proc_seq(*args):
	result = []
	mems = []
	numbers = ['']
	for a in args:
		mems.append(list(set(str(a))))
	nnumbers = []
	for a in mems:
		nnumbers = list(map(lambda x: list(map(lambda y: y + x, numbers)), a))
		numbers = []
		for a in nnumbers:
			for b in a:
				numbers.append(b)
	numbers = list(filter(lambda x: x[0] != '0', numbers))
	numbers = list(map(lambda x: int(x), numbers))
	numbers.sort()
	if len(numbers) == 1:
		return [len(numbers), sum(numbers)]
	return [len(numbers), numbers[0], numbers[len(numbers) - 1], sum(numbers)]


from itertools import product as p

def proc_seq(*a):
	(r, s) = ([], [])
	for (i, x) in enumerate(map(str, a)):
		s += [''.join(set((d for d in x if d != '0' or i)))]
	for x in p(*[[d for d in x] for x in s]):
		r += [int(''.join(x))]
	(l, h) = (min(r), max(r))
	return [len(r)] + ([] if l == h else [l, h]) + [sum(r)]


from functools import reduce

def prod(arr):
	return reduce(lambda x, y: x * y, arr)

def proc_seq(*args):
	args = [set(str(n)) for n in args]
	args[0] -= {'0'}
	minimum = int(''.join((min(n) for n in args)))
	maximum = int(''.join((max(n) for n in args)))
	total = get_total(args)
	number = prod((len(arg) for arg in args))
	return [number, minimum, maximum, total] if number > 1 else [1, minimum]

def get_total(args):
	total = 0
	args = args[::-1]
	for (i, arg) in enumerate(args):
		total += 10 ** i * sum(map(int, arg)) * prod((len(x) for x in args[:i] + args[i + 1:]))
	return total