<p>We have some theorems about the density of prime numbers, the most famous one is probably <a href="http://en.wikipedia.org/wiki/Prime_number_theorem" rel="nofollow noreferrer">the prime number theorem</a>.</p>

<p>My question is </p>

<blockquote>
  <p>about the density of primes when we choose random numbers from a different distributions. 
  The main example I have is numbers of the form $2^a3^b5^c+1$. Are there theorems similar to the prime number theorem when we restrict the numbers to those of this form?</p>
</blockquote>

<hr>

<p>More generally, let's call a set $A \subseteq \mathbb{N}$ <em>efficiently enumerable</em> if there is a (deterministic) polytime algorithm enumerator for $A$, i.e. a polytime algorithm that whose range is exactly $A$ (and for simplicity lets assume that the enumeration is also injective so every member of $A$ appears exactly once) (is there a common name for this in the literature?).</p>

<blockquote>
  <p>Are there efficiently enumerable sets such that a theorem similar to the prime number theorem or something stronger holds for the distribution of primes in them? </p>
</blockquote>

<p>Note that if we can find prime numbers in deterministic polynomial time, then the density would be one for the corresponding set, but that is open for now, so can we get closer to density 1 by replacing $\mathbb{N}$ with another efficiently enumerable set?</p>

<hr>

<p>This came out of a discussion a few days ago about better ways of finding primes in practice. If there is a deterministic polytime algorithm to find primes then the question for the corresponding enumeration would be trivial, but since <a href="https://cstheory.stackexchange.com/q/4882/186">that is open</a>, one may want to see if there are other efficiently enumerable sets that can be used to find primes in practice. This might be related to the number of random bits that is used by a probabilistic polytime algorithm to <a href="http://en.wikipedia.org/wiki/Generating_primes" rel="nofollow noreferrer">generate primes</a> also.</p>

<blockquote>
  <p>What are the known upperbounds for the number of random bits (used by a probabilistic poly-time algorithm) are known for generating primes?</p>
</blockquote>

CC BY-SA 2.5
2011-03-10T12:14:04.917Z
I am not sure what you can hope for in the second question about primes in an “efficiently enumerable” set.  Although the definition of “efficiently enumerable” is unclear to me (you say the algorithm A is polynomial-time, but polynomial in what?), the set 2ℕ+4 should be efficiently enumerable, and it does not contain any primes.
Tsuyoshi Ito
CC BY-SA 2.5
2011-03-10T15:29:03.143Z
Since primality is in P, isn't the algorithm that enumerates all primes efficient by your definition? Or do you want an algorithm that generates numbers of length $\ell$ in time polylog($\ell$)? You should be clearer in this part.
Peter Shor 
CC BY-SA 2.5
2011-03-10T15:45:09.340Z
Could you be more specific about what you mean by generating primes? Presumably you mean sampling the prime numbers in a certain range according to a certain distribution, but it would be helpful (to me at least) if you could give both the range you consider (as a function of $n$) and the probability distribution you need (does it have to be uniformly at random, or can the probability of generating a particular prime vary as a function of it's distance from other primes according to some metric?).
Joe Fitzsimons
CC BY-SA 2.5
2011-03-10T17:23:07.990Z
@Tsuyoshi, @Peter: I assume what Kaveh meant is that there is a polynomial-time function $f$ (polynomial in the size of its input, as usual) such that it's range is exactly $A$, i.e. $f(\Sigma^*) = A$. This notion is related to, but not the same as, P-printability (see e.g. http://ftp.cs.rutgers.edu/pub/allender/pprint.pdf).
Joshua Grochow
CC BY-SA 2.5
2011-03-10T18:20:59.093Z
The question was orginally for the $2^a3^b5^c+1$ case, I tried to generalize it but I am OK with modifying to makes the question more reasonable. @Tsuyoshi, yes, but that is not an uninteresting case. The intresting case is when there are "enough" primes in $A$. @Peter, it seems to me that deciding if something is in a set in poly-time is not equivalent to enumerating/generating them in polynomial time (with the restriction that each member appears exactly once in the enumeration, without this restriction they would be equivalent), are they? (more)
Kaveh
CC BY-SA 2.5
2011-03-10T18:25:34.083Z
(continued) The range is exactly $A$ and each element of $A$ appears exactly once, I have not put a restriction on the size but I am OK with assuming that the enumeration is in the increasing order. @Joe, the inputs to the enumerator are uniformly chosen, i.e. the distribution is an element of $A$ uniformly at random. The original thing that we were interested was some kind of theorem that would say that it is "better" to choose a number from $A$ than a number from $\mathbb{N}$ to find primes of required length where $A$ is numbers of the form $2^a3^b5^c+1$.
Kaveh
CC BY-SA 2.5
2011-03-10T18:30:26.900Z
@Joshua, thanks for the link, that is interesting, the definition of $\mathbf{P}$-printable seems similar but it requires printing all memebers of $A$ up to size $n$ in poly-time and there might be exponentially many of them. I think they would be equivalent if there are only polynomially many members of $A$ of size (at most) $n$.
Kaveh
CC BY-SA 2.5
2011-03-10T18:50:50.627Z
@Kaveh: Even if $A$ were sparse ($poly(n)$ many members of size at most $n$) I think your definition implies P-printable (esp. in the variant where the outputs come in increasing order) but I don't see the other direction. In particular, your definition implies that the $n$-th member of $A$ has bit-size at most $(\log n)^k$ (or $n^k$ if you only want your enumerator to work on unary inputs $1^n$). Interesting question!
Joshua Grochow
CC BY-SA 2.5
2011-03-10T22:20:52.997Z
I still do not get the second question.  “The intresting case is when there are "enough" primes in A.”  If you restrict to the case where there are many primes in A, what do you want to prove about the distribution of primes in A?  It seems to me that you are assuming what you want as a conclusion.
Tsuyoshi Ito
CC BY-SA 2.5
2011-03-10T22:56:34.333Z
@Tsuyoshi, let me rephrase it, are there $A$s which satisfy a theorem similar to the prime numbers theorem or something stronger? How large can the density of primes can be when the numbers are chosen from such an $A$? If we can generate primes in polytime then the density would be 1, but that is open, so how close can we get to 1 by chosen numbers from an $A$? It is a relaxation of finding primes in polytime.
Kaveh
CC BY-SA 2.5
2011-03-10T23:01:35.583Z
@Kaveh: Now I understand what the second question is.  Maybe you want to update the wording of the question?
Tsuyoshi Ito
CC BY-SA 2.5
2011-03-11T19:20:38.033Z
This may be an interesting theoretical question (I don't know), but how would it help in practice?  As @Peter Shor notes, primality testing is in P, and the density of primes is known to decrease as $1/n$ for numbers of length $n$, so one can find and verify a prime of length $n$ in randomized polynomial time just by checking $N, N+1, N+2, ...$ for a randomly chosen $N$ of length $n$.  What qualitative improvement would having a polynomially denser set of candidates produce?
mjqxxxx
CC BY-SA 2.5
2011-03-11T19:21:56.290Z
@mjqxxxx, e.g. number of random bits needed, or checking smaller number of candidates.
Kaveh
CC BY-SA 2.5
2011-03-11T20:13:17.117Z
@Kaveh: if you just require the primes in *A* to have the same density as the primes in *N*, then the [quantitative version of Dirichlet's theorem](http://en.wikipedia.org/wiki/Dirichlet%27s_theorem_on_arithmetic_progressions) says that all arithmetic progressions which aren't obviously composite have the correct density of primes. If you require that the set *A* have an asymptotically higher density of primes, i.e., $\omega(1/n)$ for numbers of length *n*, I suspect this is an interesting number theory question.
Peter Shor 
CC BY-SA 2.5
2011-03-14T14:54:07.593Z
Thanks @Peter. (I will repost it on MO after a few days.)
Kaveh
<ds.algorithms><reference-request><randomness><comp-number-theory><primes>
Conditional density of primes
Kaveh
# Conditional density of primes

(Asked by: username_0 on 2011-03-10)

We have some theorems about the density of prime numbers, the most famous one is probably [the prime number theorem](http://en.wikipedia.org/wiki/Prime_number_theorem).

My question is

> about the density of primes when we choose random numbers from a different distributions.
> The main example I have is numbers of the form $2^a3^b5^c+1$. Are there theorems similar to the prime number theorem when we restrict the numbers to those of this form?

---

More generally, let's call a set $A \subseteq \mathbb{N}$ *efficiently enumerable* if there is a (deterministic) polytime algorithm enumerator for $A$, i.e. a polytime algorithm that whose range is exactly $A$ (and for simplicity lets assume that the enumeration is also injective so every member of $A$ appears exactly once) (is there a common name for this in the literature?).

> Are there efficiently enumerable sets such that a theorem similar to the prime number theorem or something stronger holds for the distribution of primes in them?

Note that if we can find prime numbers in deterministic polynomial time, then the density would be one for the corresponding set, but that is open for now, so can we get closer to density 1 by replacing $\mathbb{N}$ with another efficiently enumerable set?

---

This came out of a discussion a few days ago about better ways of finding primes in practice. If there is a deterministic polytime algorithm to find primes then the question for the corresponding enumeration would be trivial, but since [that is open](https://cstheory.stackexchange.com/q/4882/186), one may want to see if there are other efficiently enumerable sets that can be used to find primes in practice. This might be related to the number of random bits that is used by a probabilistic polytime algorithm to [generate primes](http://en.wikipedia.org/wiki/Generating_primes) also.

> What are the known upperbounds for the number of random bits (used by a probabilistic poly-time algorithm) are known for generating primes?

**Tags:** ds.algorithms, reference-request, randomness, comp-number-theory, primes

> **Comments:**
> **username_1**: I am not sure what you can hope for in the second question about primes in an “efficiently enumerable” set.  Although the definition of “efficiently enumerable” is unclear to me (you say the algorithm A is polynomial-time, but polynomial in what?), the set 2ℕ+4 should be efficiently enumerable, and it does not contain any primes.  
> **username_2**: Since primality is in P, isn't the algorithm that enumerates all primes efficient by your definition? Or do you want an algorithm that generates numbers of length $\ell$ in time polylog($\ell$)? You should be clearer in this part.  
> **username_3**: Could you be more specific about what you mean by generating primes? Presumably you mean sampling the prime numbers in a certain range according to a certain distribution, but it would be helpful (to me at least) if you could give both the range you consider (as a function of $n$) and the probability distribution you need (does it have to be uniformly at random, or can the probability of generating a particular prime vary as a function of it's distance from other primes according to some metric?).  
> **username_4**: @Tsuyoshi, @Peter: I assume what username_0 meant is that there is a polynomial-time function $f$ (polynomial in the size of its input, as usual) such that it's range is exactly $A$, i.e. $f(\Sigma^*) = A$. This notion is related to, but not the same as, P-printability (see e.g. http://ftp.cs.rutgers.edu/pub/allender/pprint.pdf).  
> **username_0**: The question was orginally for the $2^a3^b5^c+1$ case, I tried to generalize it but I am OK with modifying to makes the question more reasonable. @Tsuyoshi, yes, but that is not an uninteresting case. The intresting case is when there are "enough" primes in $A$. @Peter, it seems to me that deciding if something is in a set in poly-time is not equivalent to enumerating/generating them in polynomial time (with the restriction that each member appears exactly once in the enumeration, without this restriction they would be equivalent), are they? (more)  
> **username_0**: (continued) The range is exactly $A$ and each element of $A$ appears exactly once, I have not put a restriction on the size but I am OK with assuming that the enumeration is in the increasing order. @Joe, the inputs to the enumerator are uniformly chosen, i.e. the distribution is an element of $A$ uniformly at random. The original thing that we were interested was some kind of theorem that would say that it is "better" to choose a number from $A$ than a number from $\mathbb{N}$ to find primes of required length where $A$ is numbers of the form $2^a3^b5^c+1$.  
> **username_0**: @Joshua, thanks for the link, that is interesting, the definition of $\mathbf{P}$-printable seems similar but it requires printing all memebers of $A$ up to size $n$ in poly-time and there might be exponentially many of them. I think they would be equivalent if there are only polynomially many members of $A$ of size (at most) $n$.  
> **username_4**: @username_0: Even if $A$ were sparse ($poly(n)$ many members of size at most $n$) I think your definition implies P-printable (esp. in the variant where the outputs come in increasing order) but I don't see the other direction. In particular, your definition implies that the $n$-th member of $A$ has bit-size at most $(\log n)^k$ (or $n^k$ if you only want your enumerator to work on unary inputs $1^n$). Interesting question!  
> **username_1**: I still do not get the second question.  “The intresting case is when there are "enough" primes in A.”  If you restrict to the case where there are many primes in A, what do you want to prove about the distribution of primes in A?  It seems to me that you are assuming what you want as a conclusion.  
> **username_0**: @Tsuyoshi, let me rephrase it, are there $A$s which satisfy a theorem similar to the prime numbers theorem or something stronger? How large can the density of primes can be when the numbers are chosen from such an $A$? If we can generate primes in polytime then the density would be 1, but that is open, so how close can we get to 1 by chosen numbers from an $A$? It is a relaxation of finding primes in polytime.  
> **username_1**: @username_0: Now I understand what the second question is.  Maybe you want to update the wording of the question?  
> **username_5**: This may be an interesting theoretical question (I don't know), but how would it help in practice?  As @username_2notes, primality testing is in P, and the density of primes is known to decrease as $1/n$ for numbers of length $n$, so one can find and verify a prime of length $n$ in randomized polynomial time just by checking $N, N+1, N+2, ...$ for a randomly chosen $N$ of length $n$.  What qualitative improvement would having a polynomially denser set of candidates produce?  
> **username_0**: @username_5, e.g. number of random bits needed, or checking smaller number of candidates.  
> **username_2**: @username_0: if you just require the primes in *A* to have the same density as the primes in *N*, then the [quantitative version of Dirichlet's theorem](http://en.wikipedia.org/wiki/Dirichlet%27s_theorem_on_arithmetic_progressions) says that all arithmetic progressions which aren't obviously composite have the correct density of primes. If you require that the set *A* have an asymptotically higher density of primes, i.e., $\omega(1/n)$ for numbers of length *n*, I suspect this is an interesting number theory question.  
> **username_0**: Thanks @Peter. (I will repost it on MO after a few days.)  

---

## 0 answers

