Hector the hacker has stolen some information, but it is encrypted. In order to decrypt it, he needs to write a function that will generate a decryption key from the encryption key which he stole (it is in hexadecimal). To do this, he has to determine the two prime factors `P` and `Q` of the encyption key, and return the product `(P-1) * (Q-1)`.

**Note:** the primes used are < 10^(5)

## Examples

For example if the encryption key is `"47b"`, it is 1147 in decimal. This factors to 31\*37, so the key Hector needs is 1080 (= 30\*36).


More examples:
* input: `"2533"`, result: 9328 (primes: 89, 107)
* input: `"1ba9"`, result: 6912 (primes: 73, 97)

Source: codewars | Difficulty: EASY

Starter code: def find_key(key):
	

Solutions:
def find_key(key):
	n = int(key, 16)
	return next(((k - 1) * (n // k - 1) for k in range(2, int(n ** 0.5) + 1) if n % k == 0))


def find_key(enc):
	n = int(enc, 16)
	for i in range(2, int(n ** 0.5) + 1):
		if not n % i:
			return (i - 1) * (n // i - 1)


def prime_factors(n):
	(s, a) = ([], 2)
	while a * a <= n:
		while n % a == 0:
			s.append(a)
			n //= a
		if a >= n:
			return s
		a += 1
	if n > 1:
		s.append(n)
	return s

def find_key(encryption_key):
	(a, b) = prime_factors(int(encryption_key, 16))
	return (a - 1) * (b - 1)


def find_key(key):
	n = int(key, 16)
	(a, b) = factor(n)
	return (a - 1) * (b - 1)

def factor(n):
	for i in range(2, n):
		if n % i == 0:
			return (i, int(n / i))


def find_key(encryption_key):
	n = int(encryption_key, 16)
	i = next((i for i in range(2, int(n ** 0.5) + 1) if n % i == 0))
	return (n // i - 1) * (i - 1)


def find_key(encryption_key):
	product = int(encryption_key, 16)
	for p1 in range(2, int(product ** 0.5) + 1):
		if product % p1 == 0:
			p2 = product // p1
			return (p1 - 1) * (p2 - 1)


import math

def find_key(key):
	n = int(key, 16)
	p = [d for d in range(2, int(math.sqrt(n))) if n % d == 0]
	return (p[0] - 1) * (n // p[0] - 1)


def find_key(encryption_key):
	is_prime = lambda p: all((p % i for i in range(3, int(p ** 0.5) + 1, 2))) and (p == 2 or p % 2)
	n = int(encryption_key, 16)
	if n % 2 == 0 and is_prime(n // 2):
		return n // 2 - 1
	for i in range(3, n + 1, 2):
		if n % i == 0 and is_prime(i) and is_prime(n // i):
			return (i - 1) * (n // i - 1)