Nonresonance conditions on the potential for a semilinear elliptic problem