How do I calculate the largest prime number smaller than value x?
In actual fact, it doesn’t have to be exact, just approximate and close to x.
x is a 32 bit integer.
The idea is that x is a configuration parameter. I’m using the largest prime number less than x (call it y) as the parameter to a class constructor. The value y must be a prime number.
Some good info here on the function pi(x). Apparently,
and you can approximate pi(x) with
while