Project Euler 60 - Prime Pair Sets

Official link: https://projecteuler.net/problem=60

Note: I am not happy with my solution as my program runs in ~190 seconds

Thought Process

As said at the top, I could not think of an efficient way to find the anwser I simply had 2 functions

  1. MergedPrimeChecker(prime1, prime2)

    • This function takes 2 primes and sees if the concatenated prime1prim2 and prime2prime1 are both prime and returns True or False

  2. compute()

    • There is a quintuple (5 times) nested loop, each goes through a list of the first 10000 primes (I assumed this because we are looking for minimal sum), it check if first 2 primes return true from MergedPrimeChecker in the third loop it will if the new prime returns true with both the previous primes and so on

    • If it makes it to 5 primes that all return true with each other, stores them in a list and finally outputs the minimal summed list

I used my Prime Generator and Is_prime function from my essential functions

Interactive Code

Because the program is too slow, I don't have an interactive code, but you can view my code below!

If you have a better idea please feel free to email me because I am stuck