title: Algorithm to find largest prime number smaller than x
body: <p>How do I calculate the largest prime number smaller than value x?</p>
  
  <p>In actual fact, it doesn't have to be exact, just approximate and close to x.</p>
  
  <p>x is a 32 bit integer.</p>
  
  <p>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.</p>