# Asymptotics of sums of Dirichlet-Characters over prime numbers

Again in relation with some stuff I am currently reading, the authors make use of the following "standard argument in prime number theory":

Let $\chi$ be a non-principal Dirichlet-character. Then $$\sum_{y< p \leq x} \chi(p)\overline{\chi(p)}=\frac{x}{\log(x)}+ o\left(\frac{x}{\log(x)}\right),$$ when $x\to\infty$, where $p$ runs over prime numbers. This expression very much reminds of Polya's inequality plus some use of character orthogonality, but I don't see how to "restrict" the sum to only prime numbers.

I would be thankful if someone could point to the way how this is derived. As usual, references are most welcome!

-
You may find answers to following question of mine interesting... – Sasha Sep 26 '11 at 4:45
Note that $\chi(p)\overline{\chi(p)}=1$ for almost all $p$. The above formula is then a restatement of the prime number theorem. – Kevin Sep 26 '11 at 5:28
@Kevin: thanks for your comment. This makes clear that the above some is simply counting the prime numbers. – ex-falso-quodlibet Sep 26 '11 at 17:54

Let $m$ be the conductor of $\chi$, $\omega(m)$ its number of prime divisors and $q$ the largest prime dividing it - then for $x\ge q$ the sum is precisely $\pi(x)-\omega(m)$, because $|\chi|^2$ is always either $1$ or $0$, and is only the latter for numbers that share common divisors with $m$. The only primes that share common divisors with $m$ are those that divide it, and there are $\omega(m)$ of those (a finite amount), so all other prime numbers will contribute exactly $1$ to the overall sum. This means that $\sum\sim x/\log x$ by the prime number theorem, which gives the identity.
And I am also embarrassed to not have realized that $\chi\bar{\chi}=|\chi|^2$... – ex-falso-quodlibet Sep 26 '11 at 21:24