Divisibility question for non UFD rings

Let $p$ be a prime element. I need an example of a domain in which $p^n$ divides $ab$ and $p^n$ does not divide $a$ and $p$ does not divide $b$. Obviously, the domain I’m looking for is not a UFD.
Thanks

Solutions Collecting From Web of "Divisibility question for non UFD rings"

In any integral domain, prime products behave much as they do in UFDs. For example, their factorizations into atoms are unique. Furthermore products of primes are primal, namely, the prime divisor property $\rm\ p\ |\ ab\ \Rightarrow\ p\ |\ a\ \ or\ \ p\ |\ b\ $ generalizes from atoms to composites as follows

Theorem $\, $ In domain $\cal D\,,\, $ prime product $\rm\, C\mid AB\, \Rightarrow\, C = ab,\ a\mid A,\ b\mid B,\, $ some $\rm\ a,b\in \cal D$

Proof $\ $ By induction on product length $\rm\,n.\,$ Trivial if $\rm\ n = 0\!:\,$ then $\rm\ C = 1\ $ so take $\rm\ a = 1 = b\,.\,$

Else $\rm\,n\ge 1\,$ so $\rm\, C = pc,\ p\,$ prime. $\rm\, C = pc\mid AB\, \Rightarrow\, p\mid A\ $ or $\rm\ p\mid B.\,$ W.l.o.g assume $\rm\ p\mid B\,$ so

$\quad \rm pc\mid AB\ \Rightarrow\ c\mid A\,(B/p)\quad $ since $\rm\ p\ne 0\ \Rightarrow\ p$ cancellable, by $\,\cal D\,$ domain

$\rm\qquad\qquad\quad\! \Rightarrow\ \ c\ =\ ab,\ \ a\mid A,\ \ b\mid B/p\quad $ by induction

$\rm\qquad\qquad\ \ \Rightarrow\ \ C = pc\ =\ abp,\ \ a\mid A,\ \ bp\mid B\quad $ QED

Corollary $\ $ In domain $\cal D\,,\ $ prime power $\rm\ p^n\mid AB,\ \ p\nmid B\ \, \Rightarrow\ p^n\mid A$

You can show by induction that this is impossible. For $n=1$, this is just the definition of $p$ being prime. Now assume that it is impossible for $n$ but possible for $n+1$. Let $p^{n+1}\mid ab$ but $p^{n+1}\nmid a$ and $p\nmid b$. Then $ab=p^{n+1}c=p(p^nc)$, and since $p$ is prime and $p\mid ab$ and $p\nmid b$, we must have $p\mid a$, so $ab=(pd)b=p(db)$. Cancelling $p$ in $p(p^nc)=p(db)$ yields $p^nc=db$ with $p^n\nmid d$ (since $p^{n+1}\nmid a$), but this is impossible by the induction hypothesis.

Contrary to joriki (who gives a perfect answer to his interpretation of the question), I interpreted $p$ in your question as an ordinary prime integer.
In that case, given indeterminates $A,B$ over $\mathbb Z$, the domain $D=\mathbb Z[a,b]=\mathbb Z[A,B]/(A\cdot B-p^n)$ has the properties you require.

[Integrity comes from irreducibility of $A\cdot B-p^n$ and the very construction ensures that $p^n$ divides $ab=p^n$.
That $p^n$ does not divide $a$ and that $p$ does not divide $b$ can be seen by a trick: divide out the domain $D$ by the ideal $(b)$ resp. $(a)$]

The following statements are straightforward and answer immediately (joriki’s interpretation of) your question:

$\bullet$ If an element of your domain is of the form $p^na$ with $p\nmid a$, then the pair $(n,a)$ is unique.

$\bullet$ If two elements are of this form, so is their product.