Add up to Even Number with Primes

Published by Mubashir Hassan in

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

Examples

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

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

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

Notes

N/A

Watch a quick demo on how Edabit works.