The problem is: "prove that every prime number is the leg of exactly one right triangle with integer sides." However, I seem to have proved that this is impossible. What did I do wrong here?
Let $p$ and $a$ be the legs of a right triangle, let $c$ be the hypotenuse, and let $p$ be prime. Then $p^2+a^2=c^2$. Now let $a=kp$ for some constant k. This now becomes $p^2+k^2p^2=c^2$, or $p^2(k^2+1)=c^2$. Since $p$ and $c$ are integers, it follows that k must be an integer as well, so $a$ is a multiple of $p$. Now take the square root: $p\sqrt{k^2+1}=c$. Again, since $p$ and $c$ are integers, $\sqrt{k^2+1}$ must then also be an integer, so $k^2+1$ must be a perfect square. However, we just showed that $k$ is itself a perfect square, and there are no two perfect squares $u$ and $v$ such that $u-v=1$.
What did I do wrong here? Thanks!


Note: there is nothing in the problem statement requiring $a = kp$ for some integer $k$, given prime $p$.
The second leg need not be a multiple of the prime leg. We would like to show that for a right triangle with a leg whose length is a prime $p$, a leg of length $s$ and an hypotenuse of length $h$, that $$p^2 + s^2 = h^2 \iff p^2 = h^2 - s^2 = (h+s)(h-s) $$ $$\iff h-s = 1 \iff p^2 = h + s \iff p \;\text{ is an odd number}.$$
So note, what we can prove that if $p$ is an odd prime, then there exists a triangle with a leg whose length is equal to $p$.
You can also try proving uniqueness by approaching this using a proof by contradiction. That is, we argue that for any length $p$ of a leg of a right triangle, where $p$ is prime, $p \neq 2$, $p$ determines a unique triangle with all side lengths integers. We've shown that such a triangle exist for any given $p$, but we need to show that there is only one possible integer length for each of the second leg, and for the hypotenuse. So we suppose, for the sake of contradiction, that there 2 distinct triangles, each with a leg length equal to $p$; but with different integer lengths for the second leg and/or the hypotenuse, respectively. Then argue to a contradiction. Once a contradiction is reach, we can conclude that indeed, one and only one such triangle exists for any given odd prime $p$.