I am currently stuck on Project Euler problem 60. The problem goes like this: The primes 3, 7, 109, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum […]

Categories

## Performing prime value pairs in python

- Post author By Full Stack
- Post date April 9, 2021
- No Comments on Performing prime value pairs in python

- Tags [109, 617 (33647 + 23003 + 16451 + 1493 + 23). It turns out that it is not the sum we're looking for. I tried the problem again using both phases., 617. Can somebody help me find a more efficient way to solving this problem. Please tell me how to solve it., 7, 7]] x = 11 #Phase 1: Create a list of length n. while getMaxLength(heap)<n: if isprime(x): m = [x], 792, and 673, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, both 7109 and 1097 are prime. The sum of these four primes, I am currently stuck on Project Euler problem 60. The problem goes like this: The primes 3, I end up with the same wrong result. Obviously, I used and created the following functions. def isprime(n): """Primality test using 6k+-1 optimization.""" if n <= 3: return, p): tmplst.append(p) if len(tmplst)>len(m): m=tmplst heap.append(m), represents the lowest sum for a set of four primes with this property. Find the lowest sum for a set of five primes for which any two primes, taking 7 and 109, the answer is less than 74, y): b = False if b == True: li.append(y) y+=2 if len(li)>=n:, y): return isprime(int(str(x)+str(y))) and isprime(int(str(y)+str(x))) def maxList(h): result = [] for s in h: if len(s)