Determine all pairs of prime numbers p and q less than 100, such that the following five numbers:
p+6, p+10, q+4, q+10, p+q+1
are all prime numbers.
If p=2 then p+10=12 is composite; if p=3 then p+6=9 is composite; if p=6k-1 then p+10=6k+9 is composite. Therefore p is of the form 6k+1.
If q=2 then q+10=12 is composite; if q=6m-1 then q+4=6m+3 is composite; if q=6m+1 then p+q+1=6k+6m+3 is composite. Therefore q=3.
With q=3 then p, p+4, p+6, and p+10 must all be prime. None of these can equal 5 for a valid solution.
p+2, p+4, p+6, p+8 and p+10 form an arithmetic progression, so one of these five values must be a multiple of 5; combined with the previous statement we must have p+2 or p+8 is a multiple of 5.
Knowing that p is of the form 6k+1, we also have p+2 and p+8 are odd multiple of 3. Then p+2 or p+8 is an odd multiple of 15. There are three multiples of 15 under 100. So it is not necessary to make a program to brute force a mere 6 cases.
p+8=15 -> 7,11,13,17 good
p+2=15 -> 13,17,19,23 good
p+8=45 -> 37,41,43,47 good
p+2=45 -> 43,47,49,53 bad
p+8=75 -> 67,71,73,77 bad
p+2=75 -> 73,77,79,83 bad
So then the pairs (p,q) which satisfy the problem are (7,3), (13,3), and (37,3).