Example 28 (2005 British Mathematical Olympiad) Determine the smallest possible value of the largest term in an arithmetic sequence consisting of 7 distinct prime numbers.

Determine the smallest possible value of the largest term in an arithmetic sequence consisting of 7 distinct prime numbers.
Let the arithmetic sequence be
$p, p+d, p+2 d, p+3 d, p+4 d, p+5 d, p+6 d$.
It is easy to see that $p>2$. Because if $p=2$, then $p+2 d$ is an even number and not 2, which is not a prime.
Since $p$ must be odd, then $d$ is even. Otherwise, $p+d$ is an even number and greater than 2, which is not a prime.
Also, $p>3$, because if $p=3$, then $p+3 d$ is a multiple of 3 and not 3, which is not a prime.
Therefore, $d$ must be a multiple of 3, otherwise, one of $p+d$ and $p+2 d$ will be a multiple of 3.
Similarly, $p>5$, because if $p=5$, then $p+5 d$ is a multiple of 5 and not 5.
Similarly, $d$ is a multiple of 5, otherwise one of $p+d, p+2 d, p+3 d, p+4 d$ will be a multiple of 5, which is not a prime. $\qquad$
Cai
Lin
Yuan
Ke
Math
in
Number
Theory
problem
In summary, we have $p \geqslant 7$ and $30 \mid d$.
If $p>7$, when $7 \times d$, there will always be a multiple of 7 in the arithmetic sequence, so $7 \mid d$. This means $210 \mid d$. At this time, the smallest possible value of the last term is $11+6 \times 210=1271$.

If $p=7$ (and $30 \mid d$), then we must avoid having $187=11 \times 17$ in the sequence. Therefore, $d \geqslant 120$.
If $d=120$, then the sequence is
$7,127,247,367,487,607,727$.
But $247=13 \times 19$, so this does not work.
When $d=150$, the sequence is
$7,157,307,457,607,757,907$, and all numbers are prime.
Since $907<1271$, this is the smallest possible value of the maximum term.