← Back to challenges

Add up to Even Number with Primes

PythonHardmathnumbersarrays

Instructions

Create a function that takes an even number (will always be greater than 4) and return a list of all pairs of prime numbers which add up to the given number.

Examples

prime_pair_list(10) ➞ ["3+7", "5+5"]

prime_pair_list(50) ➞ ["3+47", "7+43", "13+37", "19+31"]

prime_pair_list(100) ➞ ["3+97", "11+89", "17+83", "29+71", "41+59", "47+53"]

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.