I'm sure you're familiar with factorials – that is, the product of an integer and all the integers below it. 

For example, `5! = 120`, as `5 * 4 * 3 * 2 * 1 = 120`

Your challenge is to create a function that takes any number and returns the number that it is a factorial of. So, if your function receives `120`, it should return `"5!"` (as a string).

Of course, not every number is a factorial of another. In this case, your function would return `"None"` (as a string).

### Examples

* `120` will return `"5!"`
* `24` will return `"4!"`
* `150` will return `"None"`

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def reverse_factorial(num):
	

Solutions:
def reverse_factorial(num):
	c = f = 1
	while f < num:
		c += 1
		f *= c
	return 'None' if f > num else '%d!' % c


def reverse_factorial(num):
	n = 1
	f = 1
	while f < num:
		n += 1
		f = f * n
	return f'{n}!' if f == num else 'None'


from math import factorial
facts = {factorial(n): n for n in range(1000)}

def reverse_factorial(num):
	res = facts.get(num, 0)
	return '%s!' % res if res else 'None'


def reverse_factorial(num):
	i = 1
	while num > 1:
		i += 1
		if num % i != 0:
			return 'None'
		num //= i
	return f'{i}!' if num == 1 else 'None'


from itertools import count

def reverse_factorial(num):
	for x in count(1):
		if num == x:
			return f'{x}!'
		(num, r) = divmod(num, x)
		if r:
			return 'None'


def reverse_factorial(num):
	i = 1
	while 1:
		(num, m) = (num / i, num % i)
		if m != 0:
			return 'None'
		if num == 1:
			return str(i) + '!'
		i += 1


def reverse_factorial(num):
	s = 1
	i = 2
	while s != num:
		if s > num:
			return 'None'
		s *= i
		i += 1
	return str(i - 1) + '!'


def reverse_factorial(num):
	c = 1
	while num % c == 0:
		num = num / c
		if num == 1:
			break
		c += 1
	else:
		return 'None'
	return '{}!'.format(c)


from math import factorial as fact
D = {fact(v): '{}!'.format(v) for v in range(1, 16)}

def reverse_factorial(num):
	return D.get(num, 'None')


def reverse_factorial(num):
	if num == 1:
		return '1!'
	i = 0
	while num > 1:
		i += 1
		(num, n) = divmod(num, i)
		if n > 0:
			return 'None'
	return '{}!'.format(i)