For each prime $p$, we can consider the set of arithmetic progression made of primes that include $p$: $A_p=\{\{a_i\}_{i=1}^k \mid \text{$\{a_i\}_{i=1}^k$ is an arithmetic progression, each $a_i$ is a prime, and $p=a_j$ for some $j$}\}$. Since there is no infinite arithmetic progression of primes (since for $a+nb$, $a \mid (a+na)$) we have a particular sequence in $A_p$ that is the longest among sequences in $A_p$. We may call its length $\alpha(p)$. Has this function been studied? Or does it have trivial explicit values?
Elementary Number Theory – Prime Arithmetic Progression with Fixed Element
elementary-number-theoryprime numbers
Related Solutions
Let me first prove that the number of primes is infinite. This can be achieved using the identity $$ x = \sum_{d \ge 1} \mu(d) \frac{x^d}{1-x^d} , $$ where $\mu$ denotes the Moebius function.
If there are only finitely many prime numbers $p_1$, $\ldots$ , $p_n$, then no integer larger than $N = p_1 \cdots p_n$ can be squarefree, hence $\mu(d) = 0$ for all $d > N$ but $\mu(N) \ne 0$. But then the function on the right has a pole in $x = e^{2\pi i/N}$, whereas the polynomial on the left is entire. This is a contradiction. I am sure that there are more clever ways of obtaining such a contradiction.
The identity used for proving that there are infinitely many primes $q \equiv 3 \bmod 4$ is $$ \sum_d x^d = \sum_m \mu(m) \frac{x^m}{1-x^{2m}}, $$ where the sum on the left is over all odd natural numbers $d$ not divisible by any prime $q \equiv 3 \bmod 4$, and the sum on the right is over all odd integers $m$ not divisible by any prime $p \equiv 1 \bmod 4$.
Assume that there are only finitely many primes $q \equiv 3 \bmod 4$. Then the sum on the right is finite, and the last nonzero term occurs when $m$ is equal to the product of all these primes. Setting $x = i$ we find $i^m = +i$ or $-i$ according as $m$ has an even or an odd number of prime factors, hence $i^m = \mu(m) \cdot i$ and $i^{2m} = (-1)^m = -1$. Thus $$ \sum_m \mu(m) \frac{i^m}{1-i^{2m}} = \frac i2 \cdot M, $$ where $M$ is the number of nonzero terms on the right.
On the other hand, since the number of primes is infinite, there must be infinitely primes $p \equiv 1 \bmod 4$, hence the left hand side is unbounded as $x \to i$. This is a contradiction.
Again I am certain that there are more clever ways of exploiting these identities to prove the infinitude of primes.
Suppose you want to construct an arithmetic sequence of six primes and the difference is not a multiple of $5$. You start with, let us say, $7$ and proceed with a difference of $12$ to generate $7, 19, 31, 43, 55, 67.$ Uh-oh, you got a multiple of $5$.
That's because when the difference between successive terms is not a multiple of $5$, the sequence modulo $5$ will inevitably cycle through all residues modulo $5$ and thus you inevitably hit zero modulo $5.$
You could avoid this by using $5$ itself as the multiple of $5$, but then $5$ has to begin the sequence and you find the sixth term is a multiple of $5$ again, this time composite. With a difference of $12$ like before, you get $5, 17, 29, 41, 53, 65.$ You started with $5$ and then made five increments with a common difference of $12$, so could not avoid another multiple of $5.$
You get similar problems with differences that are not multiples of $2$ or $3.$ To get a sequence of primes as long as six terms, the difference must be divisible by all of $2, 3, 5$ and thus divisible by $5$# $=30.$ The sequence $7, 37, 67, 97, 127, 157$ makes it with a difference of exactly $30.$
Now try this logic with a sequence that's $24$ primes long and infer the difference between successively terms has to have all primes factors up to and including $23.$
Best Answer
I'll assume you are considering only positive primes. If a prime progression (of length $>1$) contains $p$, then the common difference cannot be divisible by $p$. This gives an a priori upper bound of $2p-1$ on the length of the progression.
One can sharpen this to an upper bound of $p$ by balancing the fact that the common difference can't be large (else there is no room before $p$) against the fact that it must be divisible by many small primes (else it cannot go much further than $p$).
So there is an upper bound of $\alpha(p)\le p$. This is generally believed to be best possible since the standard conjectures (e.g. Schinzel's Hypothesis H) would imply that $\alpha(p)=p$. On the other hand, lower bounds are very hard to come by. We do not even know, for instance, that $\alpha(p) > 2$ for all odd primes $p$ (however it is known to be true for the vast majority of primes by Montgomery and Vaughan's work on the exceptional set of Goldbach's conjecture).