I am curious about this: suppose we consider all numbers in base $b$ such that the number of digits $n$ in this range is the same ( eg, in base $10$ it could be $10-to-99$ for $n=2$, or $100-to-999$ for $n=3$, etc; leading digit is non-zero), for the prime numbers in this range, if I were to choose a prime number at random can I expect the distribution of the digits of my prime to be uniform random? That is, $\frac{n}{b}$.

Thank you.

  • $\begingroup$ What have you tried? Where are you finding difficulties? And why is this question worth answering? $\endgroup$ Commented Jul 7, 2019 at 5:57
  • $\begingroup$ I have some heuristics, but I don't know how to go about reasoning formally about the problem. My stat skills are not that great :(. I playing around with other stuff, and it would be useful to have some intuiting, or formal reasoning, about this. $\endgroup$ Commented Jul 7, 2019 at 6:03

2 Answers 2


For any specific digit you can. In fact you can even show that a percentage of the digits are uniform.
A Theorem of Bourgain from which the above follows immediately says that

Let $n$ be large. Then there exists $\epsilon >0$ such that for any subset $I$ of $1,\ldots, n-1$ of size $\leq \epsilon n$ and for any choice of $a_i\in \{0,1\}$, $i\in I$, the number of primes $1\leq p\leq 2^n$ such that the $i$-th digit is $a_i$ for all $i\in I$ asymptotically equals to $\frac{2^{n-\#I}}{n\log 2}$ as $n\to \infty$.

(Here $\log =\log_{e}$. Also recall that the number of primes up to $2^n$ asymptotically equals to $\frac{2^n}{n\log 2}$.)

  • $\begingroup$ Any specific digit except the rightmost digit, that is (and this is true in any base). Does Bourgain's work address bases other than 2? $\endgroup$ Commented Jul 7, 2019 at 7:05
  • $\begingroup$ This is why I took the digits from 1 to n-1 and not from 0. So $p=\sum_{i=0}^{n-1} a_i 2^{i}$. I think everything he does work in any basis, but he chose to do basis 2. $\endgroup$
    – Lior B-S
    Commented Jul 7, 2019 at 7:51
  • $\begingroup$ It is unclear to me how this helps. Also, the statement above is slightly different from the one in the paper; in particular, the paper states c is a universal constant, which they also did not give an example of even if not sharp. That would be useful. As for it being true for other bases, given the machinery they used to prove the result it is unclear to me that the methods would hold in a different base. Also, how large is "large"? I am actually computing things, so having actual bounds matters to me. $\endgroup$ Commented Jul 7, 2019 at 18:52
  • 2
    $\begingroup$ The method used is Fourier analysis and the circle method which in principle are explicit. Same for how big is n (since the error term in principle could be made explicit) Regarding to have it helps, you get that to any choice of epsilon digits the number of primes is the same, hence the prime equidistrbute among the different possibilities. $\endgroup$
    – Lior B-S
    Commented Jul 8, 2019 at 10:16

In an odd base, an odd number always has an odd number of odd digits.


$$\begin{eqnarray}(2n+1)+(2p+1)=2q \\ (2r+1)+(2s)=(2t+1) \\ (2u)+(2v)=(2w)\end{eqnarray}$$

By $$(x+y)+z=x+(y+z)\tag{4}$$ and $$a+c+d=a+d+c=c+a+d=c+d+a=d+a+c=d+c+a\tag{5}$$ we have $$\underbrace{(2h+1)+\cdots +(2h+1)}_{\text{2i+1 times}}=2e+1\implies (2i+1)(2h+1)=(2e+1)$$ $$ 123456789_b=1\cdot b^8+2\cdot b^7+3\cdot b^6+4\cdot b^5+5\cdot b^4 +6\cdot b^3+7\cdot b^2+8\cdot b^1 +9\cdot b^0$$ that in an odd (2h+1) base b, that all odd digits create odd summands. it follows from (1),(2)(3), that the even (2u) digits create even (2w) summands regardless of base.

even (2v) bases luck out in that $b^0=1\quad b\neq 0$. Otherwise, they couldn't represent odd (2r+1) numbers at all.

There are other things like all primes greater than 3 being 1 or 5 on division by 6, that can play with things. in a $6k+1$ base, then the last digit being $6j+4$, will force the rest of the digits to represent a number of forms $6l+1$ or $6m+3$ etc.

  • $\begingroup$ Could you improve this by using more math and less English? Thank you. $\endgroup$ Commented Jul 7, 2019 at 18:55
  • 1
    $\begingroup$ I don't call it improvement. $\endgroup$
    – user645636
    Commented Jul 7, 2019 at 19:32
  • $\begingroup$ I mean, the associativity and commutativity property were fine. I got that. I meant expand the reasoning using equations for your paragraph. I agree, i would not call this an improvement. Also, the concept of “odd” only make sense for bases that have to 2 as a factor...like base 10,2 or 16 which are common bases. In base 3, what’s an odd number? A number that ends in 1 or 2? $\endgroup$ Commented Jul 7, 2019 at 19:39
  • $\begingroup$ no the concept of odd is a number with remainder of 1 on division by 2. $\endgroup$
    – user645636
    Commented Jul 7, 2019 at 19:45
  • $\begingroup$ By that definition, your statement is trivially true. $\endgroup$ Commented Jul 7, 2019 at 19:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .