Getting Constraints are inconsistent and cannot be solved error.while generating prime number

In reply to gsulliva:

That is correct. Inputs to user defined functions get solved first, then the output of the function is used a constant value. The solver is not required to keep trying other input values to get an output value that meets a constraint on it.