|
Design
Picked first two number to be 2 and 2 (if even) or 2 and 3 (if odd). Iterated through the primes array subtracting it from i (after subtracting either 4 or 5 because of the first two numbers), then determining if the difference is prime. Stored primes up to 3163 in an array, so if the number to determine is prime is less than 3163, it is a simple look up. Otherwise, we see if the number is divisible by any prime less than the square root of that number. If solution was found, return the 4 numbers, otherwise return 4 0's to represent not found. |