An ideal $I \leq R$ is called primary if $\forall ab\in I$ than either $a\in I$ or $b^n \in I$ for some $n \in \mathbb{N}$. A polynomial $p(x)$ is called primary if the ideal $(p(x)) \leq R[x]$ is primary.
Trivial example: $(x^2) \leq R[x]$ or $(q^n(x)) \leq R[x]$ for an irreducible polynomial $q(x)$, are primary ideals.
I believe that when $R$ is a field (or even UFD) all primary polynomials are of the form $q^n(x) \in R[x]$ for an irreducible polynomial $q(x)$ due to unique factorization. However, I am concerned with the case where $R=\mathbb{Z}_{p^s}$. Due to some theorem* I know the following should be examples of primary polynomials,
$(x^2+x+1)(x^2+3x+1)$ in $\mathbb{Z}_{2^2}$ or even $(3x+1)(x+1)$ in $\mathbb{Z}_{2^2}$ is supposedly an example.
However, I fail to see why these examples work or with rough terms how can a nontrivial example of a primary polynomial can occur?
*Aforementioned theorem: For $f(x) \in \mathbb{Z}_{p^s}$ if $\overline{f(x)} = g^n(x)$ where $\overline{f(x)} , g(x) \in \mathbb{F}_p(x)$ and $g(x)$ is irreducible then $f(x)$ is primary. (overline denoted the image of f(x) in the quotient $\mathbb{Z}_{p^s}/(p) \cong \mathbb{F}_p$).
Just to take your second example, in $\Bbb Z_4$, we have $$ (3x+1)(x+1) = (1-x)(1+x) = 1-x^2 $$ This is a non-trivial primary polynomial because it's reducible, and not the power of an irreducible polynomial, but the ideal $(1-x^2)$ is a primary ideal. For instance, $(1-x)(1+x)$ is contained in the ideal, but neither of the factors are in the ideal. However, $$ (1-x)^4 = 1-2x^2+x^4 = (1-x^2)^2 $$ is an element of the ideal.