# Distribution of primitive roots, as p varies

For a prime number $p$, let $\Phi(p)$ be the subset of $\{ 1, 2, \ldots, p-1 \}$ consisting of primitive roots modulo $p$. (Thus $\# \Phi(p) = \phi(p-1)$, where $\phi$ denotes the totient.)

I am curious about the distribution of $\Phi(p)$ as $p$ varies. I imagine that this is classic analytic number theory, but I'm finding it surprisingly hard to locate a precise statement/reference.

To make my question precise, consider the following: For any continuous function $f \colon [0,1] \rightarrow {\mathbb R}$, define $$D_p(f) = \frac{1}{\phi(p-1)} \cdot \sum_{x \in \Phi(p)} f \left( \frac{x}{p-1} \right).$$

Does this sequence of distributions $D_p$ converge (e.g., weakly in measure, or in some stronger sense?) to the uniform measure or something else on $[0,1]$? What's the best current result along these lines?

Let me adjust your quantity slightly as $$\tilde D_p(f) := \frac{1}{\phi(p-1)}\sum_{x \in \Phi(p)} f \left( \frac{x}{p} \right),$$ and let me initially impose the natural condition $f(0)=f(1)$. Then I claim that $$\lim_{p\to\infty}\tilde D_p(f)=\int_0^1 f(t)\,dt.$$

It suffices to show the claim when $f(t)=e^{2\pi iat}$, where $a$ is a nonzero integer. In this case, by Lemma 2 in Carlitz's paper, $$\tilde D_p(f)=\frac{1}{\phi(p-1)}\sum_{x \in \Phi(p)}e_p(ax)=\frac{1}{p-1}\sum_{d\mid p-1}\frac{\mu(d)}{\phi(d)}\sum_{\substack{\chi\bmod{p}\\\mathrm{ord}(\chi)=d}}\sum_{x=1}^{p-1}\chi(x)e_p(ax).$$ For $p$ exceeding $a$, the inner Gauss sum is always of absolute value at most $\sqrt{p}$, hence $$\left|\tilde D_p(f)\right|\leq\frac{\tau(p-1)}{p-1}\sqrt{p}=p^{-1/2+o(1)},$$ which tends to zero quite optimally. The proof is complete.

Now we can remove the condition $f(0)=f(1)$ by a simple formal argument. Indeed, altering $f$ in a small neighborhood of zero has little effect on $\tilde D_p(f)$ or $\int_0^1 f(t)\,dt$ by what we have proved already (examine bump functions around zero). Thanks to Will Sawin for pointing this out!

• Wonderful, thank you! If you know of an early reference, please let me know too. I poked around in work of Carlitz and Davenport a bit, but didn't find this statement. Commented Jan 11, 2018 at 22:25
• @Marty: I have not come across this statement either. Thanks for asking! Commented Jan 11, 2018 at 22:28
• @Marty The first reference I can find is in my answer. Commented Jan 12, 2018 at 6:00

A more general result (for general finite fields) is proved in.

Perel’muter, G.I.; Shparlinskij, I.E., The distribution of primitive roots in finite fields, Russ. Math. Surv. 45, No.1, 223-224 (1990); translation from Usp. Mat. Nauk 45, No.1(271), 185-186 (1990). ZBL0705.11078.

• I don't see the result there... that paper seems to consider the number of primitive roots within an interval of a certain type within $\FF_{p^n}$ as $n$ grows. The result there might be deeper, but it's not clear to me whether it implies the result stated by GH above. The exponential sum method is similar, as expected I guess. Commented Jan 12, 2018 at 6:46