New Scientist Enigma 938 – Trios of Primes
by Richard England
From Issue #2093, 2nd August 1997 (link)
Harry, Tom and I were trying to find sets of three two-digit prime numbers such that if we added any two numbers of the set together the answer was double a prime. Within each set the three prime numbers had to be different; but we each found that, having created a set, we could then create a second set with the same properties by changing just one of its primes.
One of my two sets was the same as one of Harry’s sets and the other was the same as one of Tom’s; their other sets were different.
(1) What were my two sets?
(2) Which set might we have found whose three primes do not appear in any other set?
One Comment
Leave one →
-
Brian Gladman permalink1234567891011121314151617181920212223242526272829303132333435363738from itertools import combinations# two digit primespr = tuple(n for n in range(11, 100, 2) if all(n % p for p in {3, 5, 7}))# collect all triples of the required formpt = [p for p in combinations(pr, 3)if all((sum(p) - x) // 2 in pr for x in p)]# collect pairs of triples that share two primesppt = [(a, b) for a, b in combinations(pt, 2)if len(set(a).intersection(b)) == 2]# consider Dick's pair of triplesfor d_pt in ppt:l_th_pt = []# consider Tom and Harry's pairs of triplesfor th_pt in ppt:# store pairs of triples that share one triple with Dick's tripleif len(set(d_pt).intersection(th_pt)) == 1:l_th_pt.append(th_pt)# consider triple pairs for Tom and Harryfor th_pt, ht_pt in combinations(l_th_pt, 2):# Dick's triples that are not shared with Tom and Harry must be differentif len(set(frozenset(x).difference(d_pt) for x in (th_pt, ht_pt))) == 2:print(f"(1) Dick's triples: {d_pt}")print(f" Tom's/Harry's triples: {th_pt}, {ht_pt}")# find the triple that shares no primes with othersfor p in pt:if not any(set(p).intersection(x) for x in pt if x != p):print(f"(2) The other triple: {p}")