# Speeding through the primes until they look uniform

Imagine you are traveling out the $x$-axis such that your velocity at $x$ is $v(x)$. If $v(x)=1$, then you pass the primes at increasingly longer intervals, on average (of course there are close primes, e.g., twin primes). Is there some function $v(x)$ so that the event of passing a prime becomes uniformly random, in that the expected time between passing primes becomes a constant? For example, $v(x) = x / \log^2 x$ doesn't quite work, in that the delay between passing primes still increases with $x$.

-
Does it matter how many primes did we pass with the last move? – Ilya Jul 25 '11 at 13:37
Alex B.'s comments below indicate that essentially what I am asking for would require the resolution of an open problem, open even assuming the Generalized Riemann Hypothesis! – Joseph O'Rourke Jul 25 '11 at 17:44

A tautological solutions would be variations of the step function $$v(x) = 1/d(p_x)$$ where for each $x$, $p_x$ is the biggest prime less than or equal to $x$ and $d(p)$ is the distance between the prime $p$ and the next prime. Of course, we can turn this into a smooth function by multiplying by suitable bump functions (and adjusting the levels of the steps slightly, so as to insure that the time it takes to travel between two primes stays the same).

Unfortunately, a non-tautological solution, even conjectural, that insures that the time intervals between two primes on average converge to a constant value is completely out of reach. If we had such a closed form formula for the velocity, then in particular it would yield an approximate formula for the prime counting function $\pi(x)$ whose error term tends to 0. This is not even known under the GRH and might not even exist.

-
Perhaps my question is not well-posed. I am imagining that, as you travel along the $x$-axis, you click a stop-watch as you pass each prime, and note the time difference. If you travel at a constant velocity, this time difference will grow. If you maintain a huge acceleration, the primes will occur closer together in time. I'm seeking a velocity function that makes them show up at regular intervals (on average). What is not well-posed here is that I would want the velocity to satisfy some smoothness criteria to exclude your step function. :-) – Joseph O'Rourke Jul 25 '11 at 16:17
"Or do you want the mean of the deviations to tend to 0?" Yes! But now I see that I'm inadvertently asking for the solution to an open problem! – Joseph O'Rourke Jul 25 '11 at 17:41
@Joseph Thank you for clarifying the question. I have incorporated all our comments into the answer, so I guess we can delete them. – Alex B. Jul 26 '11 at 2:42

My closest interpretation to your question is if there is a function $v(t)$ such that

$$\pi\left( \int_0^T v(t)dt\right)\sim aT$$

for some "prime-hitting" frequency $a$. The answer is yes. We'll look at a basic example. Denote the position function as $F(T) = \int_0^T v(t)dt$, then, using PNT (Wikipedia / MathWorld), transform the equation into a more tractable form

$$\frac{F(T)}{\ln F(T)} \sim aT.$$

We will do one better and ensure equality of the above expression. (This is not the same as equality in the original asymptotic formula with $\pi(\cdot)$, but still entails our original desired form as a logical consequence.) Take the negative reciprocal of both sides,

$$\frac{1}{F(T)} \ln \frac{1}{F(T)} = -\frac{1}{aT},$$

and then use the Lambert W function (Wikipedia / MathWorld) to simplify,

$$\ln\frac{1}{F(T)} = W\left(-\frac{1}{aT}\right)$$ $$F(T) = \exp\left( - W\left(-\frac{1}{aT}\right)\right)$$

which gives:

$$v(t) = \frac{d}{dt} \exp\left( - W\left(-\frac{1}{at}\right)\right).$$

Note you can use a derivative formula for $W(\cdot)$ found in the linked articles alongside the chain rule if you so desire. And you can use even better asymptotes of the prime counting function with the same inverse-function reasoning in order to obtain velocities with more uniform prime-hitting.

EDIT: There might be problems in realizing this empirically due to the domain of the $W$ function and branch cuts. I'm having problems figuring how how to get a working graphic off of Alpha, or if my formula needs to be augmented to address some technicality I'm not seeing.

-
This is a nice analysis! Ultimately I'd like a computable function $v(t)$ so one could (essentially) make a movie of passing the primes, as if they were roadside signs. – Joseph O'Rourke Jul 25 '11 at 15:53
+1 for Lambert's W function. – draks ... Feb 29 '12 at 19:05