The concept of "[smooth number](https://en.wikipedia.org/wiki/Smooth_number)" is applied to all those numbers whose prime factors are lesser than or equal to `7`: `60` is a smooth number (`2 * 2 * 3 * 5`), `111` is not (`3 * 37`).

More specifically, smooth numbers are classified by their highest prime factor and your are tasked with writing a `isSmooth`/`is_smooth` function that returns a string with this classification as it follows:

* 2-smooth numbers should be all defined as a `"power of 2"`, as they are merely that;
* 3-smooth numbers are to return a result of `"3-smooth"`;
* 5-smooth numbers will be labelled as `"Hamming number"`s (incidentally, you might appreciate [this nice kata on them](https://www.codewars.com/kata/hamming-numbers));
* 7-smooth numbers are classified as `"humble numbers"`s;
* for all the other numbers, just return `non-smooth`.

Examples:
```python
is_smooth(16) == "power of 2"
is_smooth(36) == "3-smooth"
is_smooth(60) == "Hamming number"
is_smooth(98) == "humble number"
is_smooth(111) == "non-smooth"
```
The provided input `n` is always going to be a positive number `> 1`.

Difficulty: EASY
Tags: Number theory

Starter code:
def is_smooth(n):
	

Solutions:
def is_smooth(n):
	for x in [2, 3, 5, 7]:
		while n % x == 0:
			n //= x
		if n == 1:
			return ('power of 2', '3-smooth', 'Hamming number', 'humble number')[(2 < x) + (3 < x) + (5 < x)]
	return 'non-smooth'


from collections import defaultdict
names = defaultdict(lambda : 'non-smooth', {2: 'power of 2', 3: '3-smooth', 5: 'Hamming number', 7: 'humble number'})

def is_smooth(n):
	divisors = set()
	for d in [2, 3, 5, 7]:
		while n % d == 0:
			divisors.add(d)
			n //= d
	if n != 1:
		divisors.add(9)
	return names[max(divisors, default=9)]


def find_factors(n):
	factors = []
	for i in (7, 5, 3, 2):
		while n % i == 0:
			n = n / i
			factors.append(i)
	if n > 0:
		return factors + [n]
	return factors

def is_smooth(n):
	f = {2: 'power of 2', 3: '3-smooth', 5: 'Hamming number', 7: 'humble number'}
	return f.get(max(find_factors(n)), 'non-smooth')


is_smooth = lambda n, p=0: ['power of 2', '3-smooth', 'Hamming number', 'humble number', 'non-smooth'][p] if n < 2 or p > 3 else is_smooth(n, p + 1) if n % [2, 3, 5, 7, 11][p] else is_smooth(n // [2, 3, 5, 7, 11][p], p)


def is_smooth(n):
	primes = set()
	n1 = 0
	while n1 != n:
		n1 = n
		for p in {2, 3, 5, 7}:
			if n % p == 0:
				primes.add(p)
				n //= p
	if n != 1:
		return 'non-smooth'
	return {2: 'power of 2', 3: '3-smooth', 5: 'Hamming number', 7: 'humble number'}[max(primes)]


def is_smooth(n):
	i = 2
	a = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			a.append(i)
	if n > 1:
		a.append(n)
	m = max(a)
	if m == 2:
		return 'power of 2'
	if m == 3:
		return '3-smooth'
	if m == 5:
		return 'Hamming number'
	if m == 7:
		return 'humble number'
	else:
		return 'non-smooth'


from numpy import prod

def is_smooth(n):
	number = n
	divisors = []
	while 1:
		if not n % 2:
			divisors.append(2)
			n /= 2
		else:
			break
	while 1:
		if not n % 3:
			divisors.append(3)
			n /= 3
		else:
			break
	while 1:
		if not n % 5:
			divisors.append(5)
			n /= 5
		else:
			break
	while 1:
		if not n % 7:
			divisors.append(7)
			n /= 7
		else:
			break
	if prod(divisors) == number and max(divisors) == 2:
		return 'power of 2'
	elif prod(divisors) == number and max(divisors) == 3:
		return '3-smooth'
	elif prod(divisors) == number and max(divisors) == 5:
		return 'Hamming number'
	elif prod(divisors) == number and max(divisors) == 7:
		return 'humble number'
	else:
		return 'non-smooth'


from math import sqrt

def is_smooth(n):
	smooth = {2: 'power of 2', 3: '3-smooth', 5: 'Hamming number', 7: 'humble number'}
	s = set()
	i = 2
	while i <= sqrt(n):
		while n % i == 0:
			s.add(i)
			n //= i
		i += 1
	s.add(n)
	return smooth.get(max(s), 'non-smooth')


from functools import reduce
from operator import mul

def is_smooth(n):
	num = n
	factors = [1]
	prime_fact = iter([i for i in (2, 3, 5, 7) if not n % i])
	fact = next(prime_fact, n)
	while reduce(mul, factors) != n and fact != 0:
		if not num % fact:
			factors += [fact]
			num /= fact
		else:
			fact = next(prime_fact, 0)
	return 'non-smooth' if fact == 0 else 'power of 2' if factors[-1] == 2 else '3-smooth' if factors[-1] == 3 else 'Hamming number' if factors[-1] == 5 else 'humble number' if factors[-1] == 7 else 'non-smooth'