# Six prime number form an arithmetic progression…

Six prime number form an arithmetic progression, what's the littlest value the last (sixth) term can have?

I saw this question and I didn't know how to solve. If there's like some key to solving to it let me know.

• I would write a tool for that. Not counting the trivial cases, the difference between the consecuting primes should be divisible with 30 (least common denominator of 2, 3 and 5). The tool would first use Eratosthenes' Sieve method to find all the primes until a big number (I suggest until around 10million as start), then it would look for the differences with a linear search. The result will be likely some thousands or ten of thousands (my guess). C++ has very nice boolean array implementations. – peterh says reinstate Monica May 28 '18 at 0:54

• It's worth explaining why $157$ is the least such value. The common difference has to be a multiple of $2$, $3$, and $5$, since otherwise, some term in the progression will be a multiple of one of those. Then it becomes obvious that the initial term can't be $2$, $3$, or $5$, so this is indeed the least such value. – Kevin Long May 28 '18 at 1:26
• @joseestebanbeleñobarrozo this was said very well by peterh in his comment below your question. You could call it the pigeonhole principle. If the common difference were odd, more than one number would be even so not all prime. If the common difference were not divisible by $3,$ some of the numbers would be $1 \pmod 3,$ some would be $2 \pmod 3,$ and some (two of them, actually) would be zero $\pmod 3.$ About 5, if the first prime is 5, then the sixth number is also divisible by 5 (if the common difference is not a multiple of 5). The smallest prime cannot be 2 or 3. ... – Will Jagy May 28 '18 at 2:05
• @joseestebanbeleñobarrozo Let $m$ and $n$ be positive integers with $\gcd(m,n)=1$. Then the sequence $m,2m,3m,\ldots,nm$ when taken mod $n$ will give the integers from $1$ to $n$, each occurring exactly once. For example, let $m=3, n=5$. Then we get $3,6,9,12,15$ which, taken mod $5$ gives $3,1,4,2,0$. Then if the common difference $d$ is not a multiple of $5$, the terms of the sequence will be $a,a+3,a+1,a+4,a+2,a$, so one of the last $5$ terms must be a multiple of $5$, contradicting the terms being prime. By a similar argument, $d$ must be a multiple of $2$ and $3$. – Kevin Long May 29 '18 at 19:25