The number ```12``` is the first number in having six divisors, they are: ```1, 2, 3, 4, 6 and 12.```
Your challenge for this kata is to find the minimum number that has a certain number of divisors.
For this purpose we have to create the function 

```find_min_num() or findMinNum() or similar in the other languages```

that receives the wanted number of divisors ```num_div```, and outputs the smallest number having an amount of divisors equals to ```num_div```.

Let's see some cases:
```
find_min_num(10) = 48 # divisors are: 1, 2, 3, 4, 6, 8, 12, 16, 24 and  48
find_min_num(12) = 60
```
In this kata all the tests will be with ```numDiv < 80```

(There will be a next kata with numDiv < 10000, Find the First Number Having a Certain Number of Divisors II, should have the help of number theory)

Enjoy it and happy coding!
(Memoization is advisable)

Source: codewars | Difficulty: EASY
Tags: Dynamic programming

Fundamentals

Data structures

Mathematics

Starter code: def find_min_num(d, n=1):
	

Solutions:
def find_min_num(d, n=1):
	while div_num(n) != d:
		n += 1
	return n

def div_num(n):
	s = n ** 0.5
	return sum((2 for k in range(1, int(s) + 1) if n % k == 0)) - (s % 1 == 0)


from collections import Counter

def number_of_div(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	mu = 1
	po = [i + 1 for i in list(Counter(factors).values())]
	for i in po:
		mu *= i
	return mu

def find_min_num(num_div):
	for i in range(1, num_div ** 4):
		num = number_of_div(i)
		if num == num_div:
			return i


def n_div(n):
	result = 0
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			result += 1 + (i * i < n)
	return result

def find_min_num(num_div):
	for i in range(num_div, 1000000):
		if n_div(i) == num_div:
			return i


(FOUND, n) = ({}, 1)
while len(FOUND) < 60:
	sq = n ** 0.5
	nDivs = sum((2 * (not n % x) for x in range(1, int(sq) + 1))) - (int(sq) == sq)
	if nDivs not in FOUND:
		FOUND[nDivs] = n
	n += 1

def find_min_num(nDivs):
	return FOUND[nDivs]


def count_divs(n):
	is_square = 0
	if n ** 0.5 % 1 == 0:
		is_square = 1
	return len([(x, n / x) for x in range(1, int(n ** 0.5) + 1) if n % x == 0]) * 2 - is_square
min_num = {count_divs(i): i for i in reversed(range(1, 10 ** 5))}

def find_min_num(num_div):
	return min_num[num_div]


def divisors(n):
	count = 2
	i = 2
	while i ** 2 < n:
		if n % i == 0:
			count += 2
		i += 1
	if i ** 2 == n:
		count += 1
	return count

def find_min_num(num):
	i = 2
	while True:
		d = divisors(i)
		if d == num:
			return i
		i += 1


find_min_num = lambda n: [0, 1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60, 4096, 192, 144, 120, 65536, 180, 0, 240, 576, 3072, 0, 360, 1296, 12288, 900, 960, 0, 720, 0, 840, 9216, 0, 5184, 1260, 0, 0, 36864, 1680, 0, 2880, 0, 15360, 3600, 0, 0, 2520, 46656, 6480, 0, 61440, 0, 6300, 0, 6720, 0, 0, 0, 5040, 0, 0, 14400, 7560, 0, 46080, 0, 0, 0, 25920, 0, 10080, 0, 0, 32400, 0, 0, 0, 0, 15120, 44100, 0, 0, 20160, 0, 0, 0, 0, 0, 25200, 0, 0, 0, 0, 0, 27720, 0, 0, 0, 45360][n]


def check(n):
	set1 = set()
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			set1.add(i)
			set1.add(n // i)
	return set1

def find_min_num(num_div):
	i = 1
	while 1:
		if len(check(i)) == num_div:
			return i
		i += 1
	return n