Re: Percentage of Prime Numbers



On May 11, 2008 2:37 PM CT, orangatang1@xxxxxxxxxxxxxx wrote:

On 11 May, 13:12, Narcoleptic Insomniac
<i_have_narcoleptic_insom...@xxxxxxxxx> wrote:

On May 11, 2008 6:36 AM CT, ad...@xxxxxxxxxxxx
wrote:

Hi,

I just checked my 10-€-Banknote and found out the
serial number is a prime number. I just asked the
European Central Bank how many Banknotes circulate
and want now to find out the chance that a randomly
picked banknote has a prime serial number. So - is
there any possibility (without crashing my PC) to
find out how many prime numbers are in a given area
of numbers?

Thanks a lot!

Yes, one way would be to use approximations of the
prime counting function (denoted pi(x)). The Prime
Number Theorem tells us that this function is
asymptotic to x / ln(x), or in other words

pi(x) ~ x / ln(x).

So, suppose that you wanted to know roughly how many
primes were between A and B (given B > A). Then,
by the PNT, we know that

pi(B) - pi(A) ~ B / ln(B) - A / ln(A)

= B ln(A) - A ln(B) / [ln(B) ln(A)]

= ln(A^B) - ln(B^A) / [ln(B) ln(A)]

= ln(A^B / B^A) / [ln(B) ln(A)]

..is roughly the number of primes between A and B.

Of course, you can divide this by (B - A) to get an
approximate density.

Regards,
Kyle Czarnecki


that is cool. any idea why?

Yes, I've always found number theory to be one of the most
beautiful branches of pure mathematics. As for "any idea
why," I'm not sure exactly what you're asking.

Out of curiosity, I've calculated a similar example of
the above method using U.S. currency. The serial numbers
on the U.S. one dollar bill (2006 series) have the form

A 12345678 B

...that is, eight digits between two letters. I am unsure
of how these digits are assigned, but let us first assume
that they range from 00000000 to 99999999. It follows
that there are 10^9 possible serial numbers (neglecting
alphabetic characters).

Moreover, the PNT states that

pi(10^9) ~ 10^9 / ln(10^9) ~= 48254942

...which implies that there are approximately 48254942
primes between 0 and 10^9. Thus, the density of primes
in this interval is

pi(10^9) / 10^9 ~ 1 / ln(10^9) ~= 0.048254942

...and hence about 4.8255% of U.S. one dollar bills (in
this case) will have a prime serial number.

It should be mentioned that there exist better
approximations to the prime counting function; namely,

pi(x) ~ li(x)

...where li(x) is the logarithmic integral of x. (I think
that someone this thread already pointed out this fact.)
If we use this approximation, then

pi(10^9) ~ li(10^9) ~= 50849234.957

...which implies...

pi(10^9) / 10^9 ~= 0.050849234957

...and so, using this approximation, we see that (in this
case) about 5.0849% of U.S. one dollar bills have a prime
serial number.

Actually, Mathematica says that pi(10^9) = 50847534, and
so the density is

pi(10^9) / 10^9 = 0.050847534

...which implies about 5.0848% of U.S. one dollar bills
(in this case) will have a prime serial number.

Note how much closer the li(x) approximation is. I don't
know about you, but I find it a bit suprising that
approximately 1 in 20 $1 bills has a prime serial! *_*

Again, purely out of curiosity, let us take a look at a
similar problem. Suppose that we have a U.S. dollar bill
whose serial begins with the digit 9.

What are the chances that such a dollar bill contains a
prime serial number? Well, this amounts to counting the
primes between 90000000 and 99999999.

Using the pi(x) ~ x / ln(x) approximation yeilds

pi(99999999) - pi(90000000) ~ 99999999 / ln(99999999) -
90000000 / ln(90000000) ~= 514761.975776

...and since there are 10^7 integers in this interval, the
density is...

[pi(99999999) - pi(90000000)] / 10^7 ~= 0.0514761975776.

Hence, approximately 5.1476% of such U.S. one dollar
bills will have a prime serial number.

Using the pi(x) ~ li(x) approximation instead yeilds

pi(99999999) - pi(90000000) ~ li(99999999) - li(90000000)
~= 544399.097718

...and so the density is about...

[pi(99999999) - pi(90000000)] / 10^7 ~= 0.0544399097718

...whicih implies approximately 5.4440% of such U.S. one
dollar bills will have a prime serial number.

However, Mathematica says that

pi(99999999) - pi(90000000) = 544501

...so the density is...

[pi(99999999) - pi(90000000)] / 10^7 ~= 0.0544501

...and hence about 5.4450% of such U.S. one dollar bills
has a prime serial.

It is interesting to note that, even though we've chosen
the first digit to be 9, we still see that about 1 in 20
U.S. dollar bills will have a prime serial.

Regards,
Kyle Czarnecki
.



Relevant Pages

  • Re: Percentage of Prime Numbers
    ... is the code for the Federal Reserve Bank. ... ..and so, using this approximation, we see that (in this ... case) about 5.0849% of U.S. one dollar bills have a prime ... The FRB distribution was ...
    (sci.math)
  • Re: Excellent accuracy in the HP50G GAMMA function--how do they do it?
    ... Stirling's approximation, truncated at the fourth or fifth term, is ... digits accuracy (in a calculating environment that allows for several ... more guard digits). ... the code internall that keeps roundoff error down to size so it is ...
    (comp.sys.hp48)
  • Re: Bit fiddling calculating fraction
    ... a)Finding a best rational approximation, with a certain maximum numerator ... and denominator, to a constant that is irrational. ...
    (comp.lang.c)
  • Re: sin (M_PI)
    ... exactly without giving an infinite number of digits (what- ... computer you can only store a finite number of digits. ... but an approximation. ... proximate calculations of functions on approximate values. ...
    (comp.lang.c)
  • Re: Pi Day Exercise
    ... 22/7 only needs 3 digits, while 355/113 needs a prodigious act of memory on SIX whole digits. ... In a sense, that is an arbitrary denominator, one chosen just because of our predilection for base 10 numbers. ... When you instead choose a denominator designed to give you a good approximation -- even if you use fewer digits -- then chances are good you can find a better approximation than that arbitrary one. ... Math in alternate bases is time consuming in the Real World. ...
    (rec.arts.sf.science)

Quantcast