# Classify all $n$ for which there exists a right triangle with coprime integer side lengths and such that its area equals $n$ times its perimeter.

I know a characterization of primitive pythagorean triples: A right triangle has coprime integer side lengths if and only if those side lengths are: \begin{align*} m^2-k^2, \qquad 2mk, \qquad m^2+k^2 \end{align*} for some $m,k \in \mathbb{N}$ where $\gcd(m,k)=1$, $\, m>k$, and $\,m\not\equiv k$ (mod $2$). So essentially I'm looking for a classification of all $n\in \mathbb{N}$ for which there exist these $m,k$ where (plugging into the area/perimeter formulas for triangles): \begin{align*} (m^2-k^2)mk=n(2m^2 +2mk) \end{align*} And then solving for $n$: \begin{align*} n = \frac{(m+k)(m-k)mk}{2m(m+k)} = \frac{(m-k)k}{2} \end{align*} Since $m\not \equiv k$ (mod $2$), $\,2 \nmid (m-k)$, and thus $k$ must be even, and $m$ odd. Set $\frac{k}{2}=c$. Maybe an answer to this problem could be that a necessary and sufficient condition for $n$ is that: \begin{align*} n=(m-2c)c \end{align*} for some $m,c \in \mathbb{N}$ where $m$ is odd, $\,m>2c$, and $\gcd(m,c)=1$. Here's my issue with this answer though - it doesn't exactly help determine if some given $n$ has the desired property or not, at least not right off the bat... For instance, if I wanted to know if there's a coprime side-length right triangle with area equaling $147$ times its perimeter... well I don't know if $147=(m-2c)c\,$ for any $m,c\in \mathbb{N}$. What else can be done here?

Let $c$ be the highest power of $2$ that goes evenly into $n$, and let $m=\frac{n}{c}+2c$. Thus every $n$ has a corresponding $m$ and $c$.
Since this makes $k$ a power of $2$ and $m$ odd, they are coprime.
Therefore we can formulate our final solution as n=pc where gcd(p,c)=1 and p is odd. Ofcourse for all n, this gives us p=1 and c=n. This gives us k=2n and m=2n+1. These are certainly coprime with m>k. And checking that they satisfy \begin{align*} (m^2-k^2)mk=n(2m^2 +2mk) \end{align*} $$\impliedby(m-k)k=2n$$ Plugging in k=2n and m=2n+1, $$((2n+1)-(2n))(2n)=2n$$ So it seems n can be any natural number.
With side lengths, $4n+1$, $8n^2+4n+1$ and $8n^2+4n$