German mathematician Christian Goldbach (1690-1764) [conjectured](https://en.wikipedia.org/wiki/Goldbach%27s_conjecture) that every even number greater than 2 can be represented by the sum of two prime numbers. For example, `10` can be represented as `3+7` or `5+5`.

Your job is to make the function return a list containing all unique possible representations of `n` in an increasing order if `n` is an even integer; if `n` is odd, return an empty list. Hence, the first addend must always be less than or equal to the second to avoid duplicates.

Constraints : `2 < n < 32000` and `n` is even


## Examples
```
26  -->  ['3+23', '7+19', '13+13']

100 -->  ['3+97', '11+89', '17+83', '29+71', '41+59', '47+53']

7   -->  [] 
```

Source: codewars | Difficulty: EASY
Tags: Mathematics

Starter code: def goldbach_partitions(n):
	

Solutions:
import math

def goldbach_partitions(n):

	def is_prime(x):
		for i in range(2, int(math.sqrt(x)) + 1):
			if x % i == 0:
				return False
		return True
	if n % 2:
		return []
	ret = []
	for first in range(2, n // 2 + 1):
		if is_prime(first):
			second = n - first
			if is_prime(second):
				ret.append('%d+%d' % (first, second))
	return ret


f = lambda n: n > 1 and all((n % d for d in range(2, int(n ** 0.5) + 1)))
goldbach_partitions = lambda n: [] if n % 2 else ['%d+%d' % (p, n - p) for p in range(n // 2 + 1) if f(p) * f(n - p)]


from itertools import chain
import numpy as np
N = 32001
xs = np.ones(N)
xs[:2] = 0
xs[4::2] = 0
for i in range(3, int(N ** 0.5) + 1, 2):
	if xs[i]:
		xs[i * i::i] = 0
primes = {i for (i, x) in enumerate(xs) if x}

def goldbach_partitions(n):
	if n % 2:
		return []
	return [f'{i}+{n - i}' for i in chain([2], range(3, n // 2 + 1, 2)) if i in primes and n - i in primes]


odd_primes = {n for n in range(3, 32000, 2) if all((n % k for k in range(3, int(n ** 0.5) + 1, 2)))}

def goldbach_partitions(n):
	if n % 2 == 1:
		return []
	if n == 4:
		return ['2+2']
	return [f'{p}+{q}' for (p, q) in sorted(((p, n - p) for p in odd_primes if p <= n - p and n - p in odd_primes))]


def goldbach_partitions(n):
	is_prime = lambda n: all((n % j for j in range(2, int(n ** 0.5) + 1))) and n > 1
	return [] if n % 2 else [f'{i}+{n - i}' for i in range(2, int(n / 2) + 1) if is_prime(i) and is_prime(n - i)]


def goldbach_partitions(n):

	def prime(a):
		if a == 2:
			return True
		if a < 2 or a % 2 == 0:
			return False
		return not any((a % x == 0 for x in range(3, int(a ** 0.5) + 1, 2)))
	if n < 4 or n % 2 != 0:
		return []
	if n == 4:
		return ['2+2']
	res = []
	x = 3
	while True:
		y = n - x
		if x > y:
			return res
		if prime(y):
			res.append(str(x) + '+' + str(y))
		x += 2
		while not prime(x):
			x += 2


def prime(givenNumber):
	primes = []
	for possiblePrime in range(2, givenNumber + 1):
		isPrime = True
		for num in range(2, int(possiblePrime ** 0.5) + 1):
			if possiblePrime % num == 0:
				isPrime = False
				break
		if isPrime:
			primes.append(possiblePrime)
	return primes

def goldbach_partitions(n):
	if n % 2 != 0:
		return []
	else:
		p = prime(n)
		res = []
		for i in p:
			if n - i in p:
				res.append('{}+{}'.format(i, n - i))
				p.remove(n - i)
		return res


import math

def goldbach_partitions(n):
	primes = []
	partitions = []
	if n % 2 != 0:
		return []
	for i in range(0, n + 1):
		if i > 1:
			for j in range(2, int(math.sqrt(i)) + 1):
				if i % j == 0:
					break
			else:
				primes.append(i)
	for i in primes:
		if i <= n / 2:
			if n - i in primes:
				partitions.append(str(i) + '+' + str(n - i))
	return partitions


sieve = [False] * 2 + [True] * 32000
for i in range(2, 200):
	if sieve[i]:
		for j in range(2, 32000):
			if i * j >= len(sieve):
				break
			sieve[i * j] = False

def goldbach_partitions(n):
	if n % 2:
		return []
	if n == 4:
		return ['2+2']
	return ['{}+{}'.format(i, n - i) for i in range(2, n // 2 + 1) if sieve[i] and sieve[n - i]]