Pavel Panchekha


Share under CC-BY-SA.

7919, 7853, and Li(x)

I just got two textbooks; like textbooks often do, they have a number in the inside cover. 7919 and 7853 were my two numbers. What's an interesting property of those numbers? Well, for starters, they're both prime. That is, neither has any factors but one and itself. Quite a coincidence, you might say. Which leads one to ask: what were the chances of that?

π(x) is a function over the natural numbers that gives the number of primes less than or equal to x. This is what we'll use to find the probability. Now, given all the interesting properties of the primes, one would guess that π(x) wouldn't have a definate form. It's true—there is no simple way to compute the value of it except by manually counting the primes. Of course, tables exist—I've actually made my own.

But that's no fun—what's a good way to calculate the value? Well, a result known as the prime number theorem proves that π(x) is close to Li(x)—that is, the logarithmic integral of x. Look:

Now, there's the slight problem in that Li(x) isn't directly calculable (it's defined in integral form). However, it's at least calculable. Using a quick definate integral evaluator, one gets a value of 1019.76 for Li(7919), or about 1019 primes. So, there seems to be a 1.6% chance of two primes in the range [1, 7919] being randomly selected. However, that isn't really a fair estimate, since the primes are much denser near 0 and they are far more scattered by the time they reach 8000. What if we take just the range [7800, 8000]? Li(x) approximations will give you about 22 primes, out of 200, which works out to about a 1.2% chance.

Now, there are a lot of other approximations for π(x). One fairly good one is \(x /(\log x)\); this differs from π(x) by at most 10% for small numbers. Even better is \(x/(\log x - 1)\). This also gives us about 22 primes in the range [7800, 8000], with the same percent chance. Now, both of the given approximations overestimate π(x). Hopefully, it doesn't matter too much in this case, as we're subtracting two values of the function.

None of this was really that necessary, though. Interestingly enough, 7919 is the 1000th prime, and there are 13 primes between 7800 and 8000 (7853 is prime number 992, by the way). So how far off were the estimates? 9 or so in a thousand isn't too bad. And by this point, the 9 primes that we overestimated by aren't really too big a deal. Of course, that makes the true probability of 0.4%, or a one in 230 chance. As far as I know, the New York lottery has a one in a few million chance. Not lucky enough yet, I guess.