I am checking if the ideals $$I=(5,x^3+2x+3), \qquad J=(4,x^2+x+1,x^2+x-1) \trianglelefteq \mathbb{Z}[x]$$ are either maximal or prime.
For the ideal $I$, by factorizing $x^3+2x+3=(x+1)(x^2-x+3)$ I discovered that $I \subseteq (5,x+1)$. Moreover I proved successfully that $I$ is indeed not maximal, since $1 \notin (5,x+1)$ and $x+1 \notin I$, which makes $(5,x+1)$ become a proper intermediate ideal between $I$ and $\mathbb{Z}[x]$. I guess that $I$ is prime because $x^2-x+3 \notin I$ but $(x+1)(x^2-x+3) \in I$. To prove this, I intend to show that there exists no $p(x),q(x) \in \mathbb{Z}[x]$ such that $$x^2-x+3=5p(x)+(x+1)(x^2-x+3)q(x) \qquad (*)$$ From ($*$) we have $(x^2-x+3) \mid 5p(x) \color{red}{\Rightarrow} (x^2-x+3) \mid p(x) \Rightarrow p(x)=(x^2-x+3)r(x)$. Substituting $p(x)$ in (*) we have $$1=5r(x)+(x+1)q(x),$$ which I have proved that it is false (there are no such $r(x)$ and $q(x)).
For the ideal $J$, by calculation I have $$\begin{array}{rcll} J &=& (x^2+x+1,x^2+x-1) & \text{(since } 4=2(x^2+x+1)-2(x^2+x-1) \text{)} \\ &=& (x^2+x+1,2) & \text{(since } 2=(x^2+x+1)-(x^2+x-1) \text{)} \end{array}$$
However, I have no idea to continue my effort.
Questions
Is the red rightarrow "$(x^2-x+3) \mid 5p(x) \color{red}{\Rightarrow} (x^2-x+3) \mid p(x)$" valid?
Are there some other ways to check that $I$ is maximal or prime? I think that $I$ is not maximal since we can factorize $x^3+2x+3$, and $J$ is not since $x^2+x+1$ is irreducible. I don't know if this idea can be generalized for arbitrary ideals in $\mathbb{Z}[x]$.
Thanks for your help.