# Find the next such set of prime numbers ending in 1, 3, 7, 9.

I was checking this number theory exercise:

The numbers $11, 13, 17, 19$ are four odd integers ending in $1, 3, 7, 9$ that lie between two multiples of $10$. Find the next such set of prime numbers ending in $1, 3, 7, 9$.

By trying several numbers I found the answer is $101,103,107,109$ but I have been unable to find such numbers by a mathematic approximation or a different way.

If you have another way it will be really appreciated.

• oeis.org/A007530 – JMoravitz Sep 8 '18 at 20:43
• Well, by looking only divisibility by $3$, we can immediately throw out the $2/3$ of possibilities, leaving only $41,\dots$, then $71,\dots$ and $101,\dots$. – Berci Sep 8 '18 at 20:44

Algebraically, given $n \equiv 15 \pmod{30}$, we have $p = n - 4$, $p + 2 = n - 2$, $p + 6 = n + 2$ and $p + 8 = n + 4$.
But do look at the 40s: we have 41, 43, 47... oh, dang, $49 = 7^2$. Actually, this suggests one other optimization, to swap 30 out for 210.
Then $n$ can be $15, 105, 195 \pmod{210}$. Looking at Sloane's http://oeis.org/A007530, you will see that except for 5, the lowest number $p$ of the prime quadruple is $11, 101, 191 \pmod{210}$.