Is it possible to estimate the number of primes between 0 and a 128 bit number?

759 Views Asked by At

I'm attempting to visualize an RSA public/private key pair, or a SHA2 hash. In order to reduce that massive number that is meaningful to humans I'm looking at this SHA2 visualization function to express large numbers as an image or perhaps as a combination of colors using additive, and subtractive complimentary colors.

That being said, I want to simplify a large prime number, and understand how it compares to the other primes that might exist in the space.

I recall that there was a theory exposed in the past year that said that all primes are within a range of 20,000 (or something) of the previous prime.

My question: how do I estimate the quantity of primes prior to a given number?

1

There are 1 best solutions below

2
On BEST ANSWER

The result of Yitang Zhang (and improved by James Maynard) in 2013 was that there exist infinitely many primes which differ by some fixed number $\leq 600$. This isn't helpful in your problem.

The number of primes smaller than $n$ is given by the prime counting function, $\pi(n)$.

It is known that $\frac{\pi(n)}{n/\log n} \to 1$ as $n \to \infty$, so one approximation would be $\frac{n}{\log n}$. You can read the Wikipedia page for further asymptotics and other things.