Solution (source code)

= Solution

Fix a positive integer $q$ and an integer $a$ <coprime> to $q$. We use <Dirichlet characters> modulo $q$, extended by <zero> on integers not <coprime> to $q$, and write $\chi_0$ for the <principal Dirichlet character>. For a <nonprincipal Dirichlet character>, the sum over one complete period is <zero>. Its partial sums $A_\chi(u)=\sum_{n\le u}\chi(n)$ are therefore $O(q)$. <Partial summation> gives
$$
L(s,\chi)=s\int_1^\infty A_\chi(u)u^{-s-1}\,du,\qquad\Re s>0.
$$
The integral converges locally uniformly there, so these <Dirichlet L-functions> are <holomorphic> at one. On the other hand,
$$
L(s,\chi_0)=\zeta(s)\prod_{p\mid q}(1-p^{-s})
$$
has a simple <pole> at one, with <residue> $\varphi(q)/q$.

The assumed <nonvanishing of a nonprincipal Dirichlet L-function at one> for real <Dirichlet characters> also excludes vanishing for nonreal ones. To prove this, form the <product over all Dirichlet characters>
$$
\mathcal F(\sigma)=\prod_{\chi\bmod q}L(\sigma,\chi),\qquad\sigma>1.
$$
Use the <logarithm> supplied by the absolutely convergent <Euler product>. The <Orthogonality of Dirichlet characters> yields
$$
\log\mathcal F(\sigma)
=\sum_{p\nmid q}\sum_{m\ge1}\frac{\sum_\chi\chi(p)^m}{mp^{m\sigma}}
=\varphi(q)\sum_{\substack{p\nmid q,\ m\ge1\\p^m\equiv1\pmod q}}\frac1{mp^{m\sigma}}\ge0.
$$
Thus $\mathcal F(\sigma)\ge1$. If a nonreal <Dirichlet character> $\chi$ had $L(1,\chi)=0$, its distinct conjugate $\overline\chi$ would also have a <zero> there, since $L(1,\overline\chi)=\overline{L(1,\chi)}$. These two <zeros> would outweigh the single <pole> of the principal factor; all other factors are bounded near one. It would follow that $\mathcal F(\sigma)\to0$ as $\sigma\downarrow1$, contradicting the lower bound. Together with the assumption for real <Dirichlet characters>, this proves $L(1,\chi)\ne0$ for every <nonprincipal Dirichlet character>.

The first-degree part of the <Euler product> <logarithm> gives
$$
\log L(\sigma,\chi)=\sum_p\frac{\chi(p)}{p^\sigma}+O(1),\qquad\sigma\downarrow1.
$$
The omitted terms are bounded uniformly, since $\sum_p\sum_{m\ge2}(mp^{m\sigma})^{-1}\ll\sum_p p^{-2}<\infty$. For each nonprincipal factor, its <logarithm> remains bounded: choose a <holomorphic logarithm> near the now established nonzero value $L(1,\chi)$; the Euler-product branch differs from it by a fixed integral multiple of $2\pi i$ on a sufficiently small real interval. For the principal factor,
$$
\log L(\sigma,\chi_0)=\log\frac1{\sigma-1}+O_q(1).
$$
Applying <Orthogonality of Dirichlet characters> again gives
$$
\varphi(q)\sum_{p\equiv a\,\mathrm{mod}\,q}\frac1{p^\sigma}
=\sum_{\chi\bmod q}\overline{\chi(a)}\log L(\sigma,\chi)+O_q(1)
=\log\frac1{\sigma-1}+O_q(1).
$$
The right side diverges as $\sigma\downarrow1$, so the <arithmetic progression> contains infinitely many <primes>. This proves <Dirichlet's theorem on arithmetic progressions>: \b[every reduced <residue class> modulo $q$ contains infinitely many <primes>]. The argument also covers $q=1$ and $q=2$, when there need not be a nonreal character.

For the sharper statement about <reciprocal primes in a fixed arithmetic progression>, use the given <prime-counting function> asymptotic with $q$ fixed:
$$
\pi(x;q,a)\sim\frac{\operatorname{li}(x)}{\varphi(q)}
\sim\frac{x}{\varphi(q)\log x}.
$$
The second equivalence follows by <integration by parts> in the <logarithmic integral function>. <Partial summation> yields
$$
H(x):=\sum_{\substack{p\le x\\p\equiv a\pmod q}}\frac1p
=\frac{\pi(x;q,a)}x+\int_2^x\frac{\pi(t;q,a)}{t^2}\,dt.
$$
For any $\varepsilon>0$, choose a fixed $T$ so large that the relative error in $\pi(t;q,a)$ is at most $\varepsilon$ for $t\ge T$. The initial integral is a constant, while the remaining integral lies between
$$
\frac{1-\varepsilon}{\varphi(q)}\bigl(\log\log x-\log\log T\bigr)
\quad\text{and}\quad
\frac{1+\varepsilon}{\varphi(q)}\bigl(\log\log x-\log\log T\bigr).
$$
The boundary term is $O_q(1/\log x)$. Divide by $\log\log x$, let $x\to\infty$, and then let $\varepsilon\downarrow0$. We obtain
$$
\boxed{\sum_{\substack{p\le x\\p\equiv a\pmod q}}\frac1p
\sim\frac{\log\log x}{\varphi(q)}.}
$$
Only a relative asymptotic is deduced from the given information; an additive $O(1)$ error, or uniformity for a growing modulus $q$, would require additional estimates.