Let $D$ be a positive integer and $p$ be a prime number . Assume $x^2+D=p^n$ has a solution $(x_0,n_0)$. The question is to find necessary and sufficient conditions for the following statement to be true. If $x^2+D=p^nm $, has a solution $(x_1,n_1,m_1)$ then there exist $k$ and $\beta$ such that $ x_1 \pm d\sqrt{d_1}= (x_0 \pm d \sqrt{d_1})^k \beta $ and $ x_1 \pm d\sqrt{d_1}= (x_0 \pm d \sqrt{d_1})^k \bar{\beta} $.
To answer this question some one said we need $ Q(\sqrt{-d_1})$ to be UFD but I guess we only need ideals $ x + d\sqrt{d_1}$ and $ x - d\sqrt{d_1}$ be relatively prime. Here is my argument is it true or are there any flaws in my argument
$p$ splits in ring of integers of $ Q(\sqrt{-d_1})$ as product of two prime ideals $P_1$ and $P_2$ , then $ < x_0 \pm d \sqrt{d_1} > = P_1^m$ as an ideal, More over from the equation $x^2+D=p^nm $ if we factor both sides to product of ideals we have $ < x_1 + d\sqrt{d_1}> < x_1 - d\sqrt{d_1} > = P_1^{n_1} P_2^{n_1} .<m>$ Since $P_i$S are prime and factors on left hand side relatively prime with some abuse of notation we have $ < x_1 + d\sqrt{d_1}>= (P_1^{n})^k <P_1^l \gamma> $ and the ideal $<P_1^l \gamma>$ is principal . so we get
$ x_1 + d\sqrt{d_1}= (x_0 \pm d \sqrt{d_1})^k {\beta} $ and $ x_1 \pm d\sqrt{d_1}= (x_0 - d \sqrt{d_1})^k \bar{\beta} $.
I don't see where we need $ Q(\sqrt{-d_1})$ to be a UFD.