Skip to content

Instantly share code, notes, and snippets.

@igorvanloo
Created July 25, 2021 04:52
Show Gist options
  • Save igorvanloo/c232ef6962324aa3de56fb314bc7d209 to your computer and use it in GitHub Desktop.
Save igorvanloo/c232ef6962324aa3de56fb314bc7d209 to your computer and use it in GitHub Desktop.
Problem 49
def compute():
primes = sorted(list(set(list_primes(10000)) - set((list_primes(1000)))))
supercandidates = []
while len(primes) != 0:
curr = primes.pop()
candidates = [curr]
for y in primes:
if sorted(str(curr)) == sorted(str(y)):
candidates.append(y)
primes.remove(y)
if len(candidates) >= 3:
supercandidates.append(sorted(candidates))
supercandidates = sorted(supercandidates)
final = []
for possible_seq in supercandidates:
for i in range(len(possible_seq)):
for j in range(i+1,len(possible_seq)):
for k in range(i+2,len(possible_seq)):
if possible_seq[j] - possible_seq[i] == possible_seq[k] - possible_seq[j] and possible_seq[j] - possible_seq[i] != 0:
anwser_str = str(possible_seq[i]) + str(possible_seq[j]) + str(possible_seq[k])
final.append(anwser_str)
return final
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment