Brahmagupta Identity.
$$ \begin{align} (a^2+nb^2 )(c^2+nd^2 ) &= (ac-nbd)^2+n(ad+bc)^2 \newline &=(ac+nbd)^2+n(ad-bc)^2 \end{align} $$
We can factor $N$ using the Brahamagupta Identity by writing $N$ as $p^2 + nq^2$ and $r^2 + ns^2$ in two different ways.
This question is about whether we can use the fact
$$ \begin{align} p &= ac - nbd \newline q &= ad + bc \end{align} $$
from one of the representations to find the other.
For e.g., say $N = 19\times 73 = 1387$.
We can write $N = 1387 = 37^2 + 18 \cdot 1^2$ taking $p = 37, q= 1$ and $n = 18$.
We take any arbitrary integer value for $a$, say $a = 1$ then
$$ \begin{align} p &= ac - nbd = 1 \cdot c - 18 bd \newline q &= ad + bc = 1 \cdot d - bc \end{align} $$
Therefore,
$$ \begin{align} -c^2 + c p + 18 d^2 - 18 d q = 0 \newline \implies -c^2 + 37c + 18 d^2 - 18 d = 0 \end{align} $$
This can be solved using Legendre's method for two variable quadratic diophantine equations.
There are multiple solutions $(c,d)$:
$$ \begin{align} c &= -332, &d &= -82 \newline c &= -332, &d &= 83 \newline c &= -260, &d &= -65 \newline c &= -260, &d &= 66 \newline c &= -108, &d &= -29 \newline c &= -108, &d &= 30 \newline c &= -8, &d &= -4 \newline c &= -8, &d &= 5 \newline c &= 0, &d &= 0 \newline c &= 0, &d &= 1 \newline c &= 37, &d &= 0 \newline c &= 37, &d &= 1 \newline c &= 45, &d &= -4 \newline c &= 45, &d &= 5 \newline c &= 145, &d &= -29 \newline c &= 145, &d &= 30 \newline c &= 297, &d &= -65 \newline c &= 297, &d &= 66 \newline c &= 369, &d &= -82 \newline c &= 369, &d &= 83 \end{align} $$
$c=37, d=1$ gives $c^2 + 18d^2 = 1387$, only a trivial divisor.
Is there a way we can fix this approach so that we can get the non-trivial divisors.
I am aware of Brillhart's method of factoring. But that requires computing the two representations which is what this question is about.