Prime factors of $x$ and $y$ assuming ${\rm lcm}(x,y) = \gcd(x,y)^2$ I know there is a relation between the $\gcd (x, y)$ and $\operatorname{lcm} (x, y)$ like this:
$$
\operatorname{lcm} (x, y) \gcd (x, y) = xy.
$$
E.g: $x = 588$ and $y = 616$
$588 = 2 ^ 2 \cdot 3 \cdot 7 ^ 2$
$616 = 2 ^ 3 \cdot 7 \cdot 11$
$\gcd (x, y) = 2 ^ 2 \cdot 7 = 28$
$\operatorname{lcm} (x, y) = 2 ^ 3 \cdot 3 \cdot 7 ^ 2 \cdot 11 = 12936$
In this case $\gcd (x, y) ^ 2$ is not equal to $\operatorname{lcm} (x, y)$
So how can I find the prime factors of $x$ and $y$ if $\operatorname{lcm} (x, y) = \gcd (x, y) ^ 2$?
 A: Let $p$ be a prime dividing $x$. If $p$ doesn't divide $y$, then $p$ divides $\DeclareMathOperator{\lcm}{lcm}\lcm(x,y)$, but not $\gcd(x,y)$, which is a contradiction. Similarly, each prime divisor of $y$ also divides $x$.
Hence $x=p_1^{m_1}p_2^{m_2}\dotsm p_k^{m_k}$ and $y=p_1^{n_1}p_2^{n_2}\dotsm p_k^{n_k}$, where $m_i\ge1$ and $n_i\ge 1$, with $p_1,\dots,p_k$ distinct primes ($k$ could be $0$, in which case $x=y=1$).
Note that
\begin{align}
\gcd(x,y)&=p_1^{\min(m_1,n_1)}p_2^{\min(m_2,n_2)}\dotsm p_k^{\min(m_k,n_k)}
\\[4px]
\lcm(x,y)&=p_1^{\max(m_1,n_1)}p_2^{\max(m_2,n_2)}\dotsm p_k^{\max(m_k,n_k)}
\end{align}
so for each $i$ we must have
$$
\max(m_i,n_i)=2\min(m_i,n_i)
$$
and that's all.
You get all numbers with this property with the following recipe. Take $p_1,\dots,p_r,q_1,\dots,q_s$ arbitrary pairwise distinct primes (it can even be $r=0$ or $s=0$; an empty product is, by definition, $1$). Take $a_1,\dots,a_r,b_1,\dots,b_s$ arbitrary integers $\ge1$. If
$$
A=p_1^{a_1}\dotsm p_r^{a_r}
\qquad
B=q_1^{b_1}\dotsm q_s^{b_s}
$$
then $x=A^2B$ and $y=AB^2$ are numbers such that $\lcm(x,y)=\gcd(x,y)^2$. Note also that any two numbers $x$ and $y$ with this property are of this form.
A: We have that:
$$\text{lcm}(x,y)\text{gcd}(x,y) = xy$$
So:
$$\text{lcm}(x,y) = \text{gcd}(x,y)^2\implies\text{lcm}(x,y)\text{gcd}(x,y) = \text{gcd}(x,y)^3$$
The LHS of this is just $xy$, so we have that:
$$xy = \text{gcd}(x,y)^3$$
Now, consider some specific prime $p$.
If this occurs in either $x$ or $y$, we have that it must occur in both (otherwise LHS $\mod p\equiv 0$, but RHS $\mod p\not\equiv 0$).
Say that $p^k$ is the highest power of $p$ that occurs in both $x$ and $y$.
Then, WLOG let $p^k\mid x$, and $p^{k+j}\mid y$ be the highest powers of $p$ in each productand.
Then, we have that:
$$x^{2k+j} \equiv x^{3k}$$
So, $j = k$, and $p^{2k}\mid y$ is the highest power of $p$ dividing $y$.
So:


*

*Factor $\text{gcd}(x,y)$ into $p_1^{e_1}\dots p_k^{e_k}$

*For each $i$, find if $p_i^{2e_i}$ divides $x$ or $y$ (it'll have to divide one). Then $p_i^{e_i}$ divides the other.

*Repeat for all $i$.


It's possible there are other relations you can pull from this condition, but this is all I see.
