I am looking for ways to construct a prime without resorting to primality test. That can be an algorithm which would generate a prime from an arbitrary number or some defined set of inputs.
For example I believe the following to be a valid answer:
inputs:
p: prime > 3
q: prime < p
L: list of odd primes up to p (inclusive)
output: prime > p, or 1
algorithm:
prod = product of all numbers in L
c = p*q-2
while(gcd(prod,c)!=1)
c = c/gcd(prod,c)
return c
p*q-2 maybe prime or composite. If it is prime, it is greater than p and gcd(prod,c)=1, we have our result right away.
If it is composite, either it has a factor greater than p or it is a power of a prime < p. In the latter case the algorithm returns 1, which is kind of failing to answer the question however this could be fixed by changing q for another prime from L. (although I have no proof that such a variant would find a new prime for any value of p)
This example is hardly useful in practice, I am wondering what other methods exists. Note that in this example the result is a "larger" prime: the result is larger than all primes given as inputs. This is not a requirement and I would be interested to get reference for algorithm constructing a "different" prime, no matter if it is smaller or larger than whatever is the input.