I was wondering about the distribution of $\sqrt{p}$ mod $1$ this morning, as one does while brushing one's teeth. I remembered the paper of Elkies and McMullen (Duke Math. J. 123 (2004), no. 1, 95–139.) about $\sqrt{n}$ mod $1$, but hadn't really thought about it before.

Question 1: is $\sqrt{p}$ equidistributed mod $1$, as $p$ varies over all prime numbers? Is this known? Within range of current techniques?

Question 2: What about subtler statistics of $\sqrt{p}$ (and $\sqrt{n}$) mod $1$?

I made three plots, giving histograms of $\sqrt{n}$ mod $1$ (for natural numbers up to 100,000) and $\sqrt{p}$ mod $1$ (for primes up to 1 million) and (for comparison) a histogram of 100,000 samples drawn uniformly at random from {0,1,...,999}. Here they are for your enjoyment.

There's some wild stuff going on, I think!

Question 2(a): What's up with these sharp peak/valleys at rational numbers, in the distribution of $\sqrt{n}$ mod $1$? They are especially prominent at fractions of the form $a / 2^{e}$. How tall are these peaks near rational numbers? They persist when sampling from the primes, i.e., in the distribution of $\sqrt{p}$ mod $1$ too.

Question 2(b): Outside of those funky spots in 2(a), the distribution of $\sqrt{n}$ mod $1$ is far *flatter* than one would expect, e.g., from samples drawn uniformly at random as displayed in the bottom histogram. This must have been noticed and quantified before... what's the relevant quantitative result here?

Question 2(c): The distribution of $\sqrt{p}$ mod 1 displays the same funky spots near rational numbers, but otherwise seems much closer (in noise-volume) to the random samples at the bottom. Maybe for a larger sample, the funkiness goes away... I don't know. Explanations or conjectures are welcome.

Question 3: These seem like natural images to look at. If you know a reference where others have drawn such pictures or studied similar phenomena, I'd love to take a look!

-------------Update after answers below-----------------

It looks like the answer to Question 1 is YES. Lucia's answer below explains this, and also some of the flatness evident in the $\sqrt{n}$ distribution mod 1.

Igor and Aaron discuss the "spikes" around rational numbers. This seems related to binning: if our bins have width 1/1000, we see spikes at multiples of 1/2, 1/4, 1/5, 1/10, etc., related to divisors of 1000. Here's a new picture, which might help us understand the behavior of the distribution of $\sqrt{n}$ mod 1 near rational numbers. I've intentionally drawn the bins so that their endpoints lie on rational numbers with denominator up to 60. (I call this Farey-binning). This seems to bring the "spikes" around rational numbers down to the same size (independent of denominator).

I think I'll accept Lucia's answer soon, because it answers the most direct Question 1. But more insights are welcome.

8more comments