I've got a question on stackoverflow where somebody asks to generate a random 18-digit prime. Unfortunately, the only prime generator is the one from OpenSSL. This prime generator is however geared towards generating primes for RSA and DSA, which means that the only parameter is the size of the prime in bits.
So the question is: how can I generate a prime of x decimal digits using the bit oriented generator? The requirements are that as much as possible of the range is utilized (i.e. the digit at position x being 1..9) and that the chances of a prime is reasonably well distributed over the range (i.e. identical to generating a prime for a generator that would accept x decimal digits as indicator of the range).
It is of course possible to run the prime generator for any of the bit sizes, and it is possible to ask for a re-run as well.