# Would calculating the nth prime ruin encryption?

I'm sure there is some proof that the nth prime can be found. But if we knew, would encryption that relies on primes be easy to decrypt?

• An ill posed question Finding the n-th prime number on Math. – kelalaka Nov 7 at 19:47
• TL;DR, only one cryptosystem in common use is based off primes, and we're phasing away from it anyway. And even then, it's based on the difficulty of factoring primes which is not necessarily made easier by being able to find the $n$th prime. – Stephen Touset Nov 7 at 20:54

No. The only plausibly relevant major cryptosystems involving that are RSA-based cryptosystems. A typical RSA prime is chosen uniformly at random from 1024-bit primes, of which there are $$\pi(2^{1024}) - \pi(2^{1023}) \approx 2^{1014} - 2^{1013} = 2^{1013}$$ possibilities, by the prime-counting approximation $$\pi(x) \approx x/\!\log x$$. Even if you could efficiently find the 1762496654486650458301017412708452577168455321425338564295164204627851827809673950656701400197184589192372578810839228796442397889449007625305174377608286256232618793314981228756675796669238641660676263338471020306341778397911556529236704830386308649499298417719554769934355960770722959180457300530690137th one, for example, that wouldn't help you to guess which prime I picked. You don't even have a hope of guessing which of the $$2^{256}$$ ChaCha keys I'm using, and there are a lot fewer of those.
The $$n^{th}$$ prime number $$p_n$$ is not known for large $$n$$. The best unconditional bounds (i.e., without assuming unproved hypotheses such as the Riemann Hypothesis) are are due to Dusart $$n\left(\ln n+ \ln\ln n-1+ \frac{\ln \ln n -2.1}{\ln n}\right)\leq p_n \leq n\left(\ln n+ \ln\ln n-1+ \frac{\ln \ln n -2}{\ln n}\right),$$ for $$n\geq 688~383.$$ This gives you an interval of size roughly $$\frac{n}{10 \ln n}\approx \frac{X}{10 \ln X \ln(X/\ln X)},$$ say around $$X=2^{1024}.$$
Magma tells me this value of $$X$$ yields an interval of length
• The stronger bounds apply for this $n$ or larger due to techniques used. These are the strongest known. If $p_n=X$ then $n$ is approximately $X/\log X$. – kodlu Nov 7 at 23:13