If I understand correctly, in the following thread


[Are There Primes of Every Hamming Weight?](https://mathoverflow.net/questions/22629/are-there-primes-of-every-hamming-weight)


two users of the site claim that it has been already proven that, for every sufficiently large $n \in \mathbb{N}$, there exist primes numbers with [Hamming weight](https://en.wikipedia.org/wiki/Hamming_weight) equal to $n$. Their claim is apparently supported by Theorem 1.2 of the paper ["Primes with an average sum of digits"](https://www.dmg.tuwien.ac.at/drmota/DMRcomp2.pdf) by M. Drmota, C. Mauduit, and J. Rivat.


Do you know if there is a text out there in which the deduction of the existence of primes with Hamming weight $n$ from the said theorem by Drmota, Mauduit, and Rivat is established in a thorough manner? Like other users of the site (see the sections of comments in the aforementioned thread), I am not totally sure of the veracity of such a claim. In case that you believe that there is no author out there that has dealt with this topic in detail but you consider that you've gotten the idea of the proof, would you be so kind as to explain it below as though I were a five-year old?


Thanks in advance for your help!



Primes with given Hamming weight
As Wojowu and alpoge have said in the comments, this follows immediately from Theorem 1.1 of Drmota-Mauduit-Rivat paper, but here is more detail on exactly why, as requested.


Theorem 1.1 of the Drmota-Mauduit-Rivat paper with $q=2$ and $k=n$ and $\epsilon=1/4$ gives that the number of primes $p\leq x$ with Hamming weight $n$ is equal to


$$\frac{\pi(x)}{\sqrt{\frac{\pi}{2}\log\_2x}} \left( e^{-\frac{(n-\frac{1}{2}\log\_2x)^2}{\frac{1}{2}\log\_2x}}+O((\log x)^{-1/4})\right),$$


where the implicit constant in the $O(\cdot)$ notation is absolute.


In particular, if $n=\lfloor\frac{1}{2}\log\_2(x)\rfloor$, the main term inside the brackets is at least $e^{-2/\log\_2x}$ and the error term is $O(e^{-\log\log x/4})$. The main term is greater than the error term (and in particular the whole expression is positive and hence $\geq 1$) provided


$$2/\log\_2x < \frac{1}{4}\log\log x-C,$$


where $C>0$ is the logarithm of whatever constant is hidden in the $O(\cdot)$ notation.


This obviously holds for all large $x$, say all $x\geq X$, and we have found at least one (actually many) primes with Hamming weight $n$ whenever $n\geq \log\_2(X)/2$. To find out exactly what this threshold is, you need to work out what the implicit constant in the $O(\cdot)$ notation is, which presumably can be done by carefully tracking the constants throughout their proof (although likely this constant will be terrible).


