# Do we know if there are more primes with even leading digits or odd leading digits?

I was just wondering, out of curiosity, do we know if there are more primes with even leading digits or odd leading digits? For example, primes with even leading digits would be $23$ or $29$ and primes with odd leading digits would be $31$ or $97$. If we haven't figured it out then how do we do something like that?

Thanks

-
It's not clear what your definition is from your examples. Also, there are probably infinitely many primes of both types. Do you mean relative asymptotic densities? – Sharkos May 15 '13 at 14:06
@Sharkos I don't know exactly what an "relative asymptotic density" is but I would be guessing that is the case. I consider an even digit prime to be a prime that has an even digit as its first number. Similarly, an odd digit would be a prime that has an odd digit at the beginning. – Jeel Shah May 15 '13 at 14:08
You can use the Prime Number Theorem to show that there more primes with a leading digit of 1,3,5,7 than there are those of 2,4,6,8 respectively. – Calvin Lin May 15 '13 at 14:15
Whoops, yes. Not many numbers start with 0, do they? Calvin Lin - can you elaborate? Does this distort the ratio or is this subleading? – Sharkos May 15 '13 at 14:17
Since $\pi (n) \sim \frac{x}{\ln x}$, the density (when defined properly) does decrease. The ratio is similar to the one obtained through Benford's law (which states that a number with leading digit d should appear $\log ( 1 + \frac{1}{d})$ times). However, I believe that the argument for prime numbers is much harder. – Calvin Lin May 15 '13 at 14:22

The Prime Number Theorem can be used to find the supremum and infimum of the relative densities. In particular for primes starting with odd digits the upper bound is 7/9 = 0.777... (if you sample numbers starting 1999...) and the lower bound is 41/81 = 0.506... (if you sample numbers starting 8999...).

The supremum of a set is its least upper bound. For a finite set, a supremum is its maximum. For infinite sets, though, the supremum may be ("slightly") greater than all the members of the set. For example, the set $\{x:x<3\}$ has supremum 3 even though all members are less than 3. You can see that there is no maximum for this set, since if you choose some $y$ in the set it is less than $(3+y)/2$ which is less than 3, and so also in the set.

Similarly, the infimum is the greatest lower bound of the set, the generalization of the minimum.

What you might like in a situation like this would be the relative density of the primes starting with odd digits in the set of primes. This would be $$\lim_{x\to\infty}\frac{\text{# of primes}\le x\text{ starting with an odd digit}}{\text{# of primes}\le x}$$

But what happens if this limit does not exist? For example, it might go up to 70%, then back down to 55%, then back up to 70%, and repeat ad infinitum. In fact this is precisely what happens!

So instead of looking for the limit, which does not exist (just like the maximum of $\{x:x<3\}$ does not exist), we look for the limit supremum and limit infimum. These always exist, and they are equal exactly when the limit exists (in which case they are equal to the limit).

But what is a limit supremum (lim sup for short)? In this case, it is $$\lim_{y\to\infty}\sup_{x\ge y}\frac{\text{# of primes}\le x\text{ starting with an odd digit}}{\text{# of primes}\le x}$$ or in other words, the largest value that the function becomes arbitrarily close to infinitely often. (If it happened only finitely often, then it happens for the last time at some $y_0$, and the limit goes beyond $y_0$ to $\infty.$)

Of course the limit inferior (lim inf) is defined similarly with $\inf$ in place of $\sup.$

So much for the preliminaries. Now it's time to look at the Prime Number Theorem. It says that there are $(1+o(1))(x/\log x)$ primes below $x.$ The meaning of $o(1)$ is technical, but basically it's just some number that becomes arbitrarily small as $x$ increases. Now for some constant $0<\alpha<1$ the number of primes between $\alpha x$ and $x$ is $(1+o(1))(x/\log x) - (1+o(1))(\alpha x/\log(\alpha x))=(1+o(1))(1-\alpha)x/\log x.$ (The different $o(1)$ are actually different numbers, so they don't cancel the way you'd expect. The notation is funny, but that's the way it's usually written.)

So basically there are just the number of primes you'd expect between $\alpha x$ and $x$ since the logarithm in the density grows so slowly.

Now we can use this to derive the densities we need. First, let's look at the relative density of the odd-starting primes between $10^{n-1}$ and $10^n.$ 5/9 start with an odd digit and 4/9 start with an even digit, since by the above use of the Prime Number Theorem the densities are what we'd expect. Now you can do the same with the primes between $10^{n-2}$ and $10^{n-1}$, etc., so for the primes below $10^n$ you have 5/9 starting with an odd digit.

But we don't want to restrict ourselves to looking just at powers of 10. What if we looked at numbers below $2\cdot10^n$? Then half would be below $10^n$ of which 5/9 would start with an odd digit, and the half between $10^n$ and $2\cdot10^n$ all start with odd digits. Thus (5/9+1)/2 = 7/9 start with odd digits. It's not hard to see that this is the best you can do.

Similarly, on the other side, if you look at $9\cdot10^n$ you have nine groups: the ones below $10^n$ have 5/9 odd first digits, the $n-$digit ones starting with 1, 3, 5, or 7 are all odd-initial, and the $n-$digit ones starting 2, 4, 6, 8 are all even-initial. Overall that's (5/9+4)/9 = 41/81. And we're done!

-
Can you please go a little more in-depth into the supremum and infimum and explain relative densities. I'm not familiar with these concepts. – Jeel Shah May 15 '13 at 14:47
@gekkostate: You can find arbitrarily large numbers where about 77.7% of the primes up to that point start with odd numbers, and arbitrarily large numbers where about 50.6% of the numbers up to that point start with odd numbers. For numbers less than 41/81 or more than 7/9 you can't do the same (though you can for any numbers between the two). – Charles May 15 '13 at 14:55
A little. I would still like more detail in the question. I am willing to offer a bounty for it when it is available. – Jeel Shah May 15 '13 at 19:53
@gekkostate: I have increased the length of my answer by a factor of ~10. I hope this helps. – Charles May 16 '13 at 14:57
Wow, this was excellently written and explained. Very easy to understand, thanks a bunch! A bounty will certainly be awarded. – Jeel Shah May 16 '13 at 16:46

One could expect that the Benford's law applies here (as Calvin Lin comments also noted), though I seems quite difficult (if possible) to prove it. Assuming that, primes starting with an odd digit would be have a relative population of 60.9%

Update: here's a relevant paper

-
Not with asymptotic density, though. You'd need to use something more sophisticated like logarithmic density. – Charles May 15 '13 at 14:55