From: rusin@vesuvius.math.niu.edu (Dave Rusin) Subject: Re: Primes Date: 10 Dec 2001 16:33:32 GMT Newsgroups: sci.math Summary: Distribution of second decimal digits in set of primes In article , Richard Carr wrote: >On 9 Dec 2001, lydia wrote: > >:Is the second digit of a prime in the decimal representation random? >:Or can it only take specific values? > >Whether the 2nd digit is random in terms of the limit of >(number of primes less than x with 2nd digit i)/(number of primes less >than x) exists and is 0.1 for each i, I don't know. The second digit of n is i precisely in intervals of the form [ a x 10^k, (a+1) x 10^k ) where a is one of 10+i, 20+i, ..., 90+i . The number pi(N) of primes less than N is about N/log(N) (with an error on the order of O(N/(logN)^2) so the number of primes in one of these intervals is about 10^k/( klog(10) + log(a) ) (with an error on the order of 10^k/k^2). Adding over each of the 9 values of a gives a sum indistiguishable from 9x10^k/(k log10) with an error of the same magnitude. In particular, the fraction f_i,k of primes between 10^(k+1) and 10^(k+2) whose second digit is i differs from 1/10 by O( 1/k ). You can similarly evaluate the fraction of all primes through 10^(k+2) if you prefer (that would be a weighted average of these previous sums, very heavily weighted in favor of the ones for larger k !) So the limit _over all powers of 10_ shows that each digit occurs as second digit in 1/10 of the primes. That's not the same as the limit you asked about (which doesn't exist) but seems like the "fair" way to compute the limit. Note on the other hand that f_i,k is _expected_ to be a decreasing function of i for each fixed k. Perhaps this is easier to see using the more accurate estimate of the primes in an interval. Ignoring the error term (always a dangerous thing to do!) we can write the number of primes between A and A+L as approximately the value of the integral \int_{A}^{A+L} 1/ln(t) dt Here the integrand is slowly decreasing with t. It follows that when counting the primes in intervals of a given length, the number of primes is smaller when the starting point A is larger. In particular, there are more primes between say 73x10^k and 74x10^k than between 74x10^k and 75x10^k (by this estimate), and by adding together 9 such inequalities, we see there are more primes with second digit 3 than with second digit 4 among the (k+2)-digit primes. You can make numerical predictions if you like. The number of primes between 10^r and 10^s (r, s need not be integral) is about \int_r^s 10^u / u du In order to count the primes between 10 x 10^k and 99 x 10^k with a given second digit, simply evaluate this integral with r = k + log_10(10+i) , s = k + log_10(11+i) ... r = k + log_10(90+i) , s = k + log_10(91+i) and add. This integral can be evaluated using special functions or numerically. For example, when k=20, this formula predicts about this many primes of 22 digits with the indicated second digit: 0 18078406298788748239 1 18067341221510144932 2 18056819259134539548 3 18046773883900915837 4 18037151546835454523 5 18027908349234261710 6 18019007738571738068 7 18010418868739174926 8 18002115404770517085 9 17994074633146640448 There is an overall drop of half a percent. Taking k=30 we get these expected distributions of the second digit among 32-digit primes: 0 123606220091906113503103725707 1 123554827038653090682779643732 2 123505912010318111692101377110 3 123459174212131308182362361798 4 123414371219747514322863679780 5 123371304062639559772899315742 6 123329806886443257308601736341 7 123289739588006747404855152393 8 123250982441457043340830464074 9 123213432094382326692973458945 This time it's an overall drop of only one-third of one percent. Continue for larger k and you'll see numerically that the fractions each approach 1/10 of the total. dave