Two numbers are **relatively prime** if their greatest common factor is 1; in other words: if they cannot be divided by any other common numbers than 1.

`13, 16, 9, 5, and 119` are all relatively prime because they share no common factors, except for 1. To see this, I will show their factorizations:
```python
 13: 13
 16: 2 * 2 * 2 * 2
  9: 3 * 3
  5: 5
119: 17 * 7
```

  
Complete the function that takes 2 arguments: a number (`n`), and a list of numbers (`arr`). The function should return a list of all the numbers in `arr` that are relatively prime to `n`. All numbers in will be positive integers.

## Examples

```python
relatively_prime(8, [1, 2, 3, 4, 5, 6, 7])
>> [1, 3, 5, 7]

relatively_prime(15, [72, 27, 32, 61, 77, 11, 40])
>> [32, 61, 77, 11]

relatively_prime(210, [15, 100, 2222222, 6, 4, 12369, 99])
>> []
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def relatively_prime (n, l):
	

Solutions:
from fractions import gcd

def relatively_prime(n, l):
	return [x for x in l if gcd(n, x) == 1]


from math import gcd

def relatively_prime(n, lst):
	return [m for m in lst if gcd(m, n) == 1]


def relatively_prime(n, l):
	lst = []
	new = set((x for x in range(1, n + 1) if not n % x))
	for y in l:
		if len(new & set((x for x in range(1, y + 1) if not y % x))) == 1:
			lst.append(y)
	return lst


G = lambda Q, S: G(S, Q % S) if S else Q
relatively_prime = lambda Q, S: [S for S in S if 1 == G(Q, S)]


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def relatively_prime(n, l):
	return [x for x in l if gcd(n, x) == 1]