Let $D$ be an integral domain and let $a\in D$. Suppose that every pair of elements $a,b\in D$ (not both zero) have a $\gcd c$ such that $c=as+bt$ for some $s,t\in D$. Prove that if $d\in D$ is irreducible then it is prime.
I know that in a PID we have an element is irreducible iff it is prime, but I can't see how to use this in this example. I thought initially we could assume $d$ to be irreducible, with $d=ab$ so that $a$ or $b$ must be $1$ by definition of irreducibility. We require $c=1$ for primality but there doesn't seem to be an easy way of proving this.