I fail to use PrimeQ
in Solve
. Simple example:
Solve[PrimeQ[p] && 0 < p < 5, p, Integers]
yields {}
rather than {{p -> 2}, {p -> 3}}
.
How can this be fixed (for more complex problems)?
There's the same issue with OddQ
rather than PrimeQ
, but I know workarounds, like
Solve[p == 2 k + 1 && 0 < p < 5, {p, k}, Integers]