Consider the follwing problem:
Given $n$ (in binary) output a prime number $p \geq n$ (not necessarily the first prime number after $n$)
Are there better techniques than the trivial one that scans $n,n+1,n+2,...$ until a prime is found?
And can we do better if the full factorization of $n$ is given?
A major optimization of your method would be