Is every prime number the leg of exactly one right triangle with integer sides? What's wrong with my argument that this is impossible? 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! 
 A: 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$.
A: To answer the question in the first part of the title, note that if $a,p$ are legs of a right triangle with hypotenuse$~c$, then $p^2=c^2-a^2=(c-a)(c+a)$. If the numbers are required to be nonzero integers and $p$ is prime, then
you can show using unique factorization that the only possibility is to have $c-a=1$. Then you can see this possibility can be realised if and only if $p$ is odd, so either in the question the word "odd" was forgotten before "prime", or the answer is simply "no".
A: There's no justification for the assumption that $a$ is a multiple of $p$ (in "let $a = kp$").  Consider the classic triangle with sides of length $3$, $4$, and $5$.  Then $a = 4$, $p = 3$, and $c = 5$, and $3^2 + 4^2 = 5^2$.  However, there's no integer $k$ such that $4 = 3k$.
A: You've already been told where your argument failed, so I won't touch that part of the question. Here is a geometrical proof of the proposition.
Existence: We want to prove that there is a right triangle with integer sides and one leg of length $p$, for some odd prime $p$. If indeed there is one, by Pythagoras' theorem we have $p^2=c^2-b^2$ for some positive integers $c$ and $b$. In particular, $p^2$ will be a difference of two squares (the grid is not up to scale in the image):
$\hskip 2.3 in$ 
Observe that $p^2$ is odd, thus $\frac{p^2 -1}{2}$ is and integer and $c=\frac{p^2 -1}{2}+1,b=\frac{p^2 -1}{2}$ will do:
$$
c^2-b^2 = 2 \frac{p^2 -1}{2}+1 =p^2
$$
Uniqueness: Either take up the suggestions of amWhy or Marc van Leeuwen, or use the following argument. If there were another way to fit $p$ in a right rectangle, the area covered by $p^2$ would span $n>1$ lines ($n=4$ in the image):
$\hskip 1.8 in$ 
In particular
$$
p^2 = 2n(c-n)+n^2 = n\left[2(c-n)+n\right]
$$
therefore $n\leq p$ and $n\mid p^2$. But $n\mid p^2$ implies $n\mid p$, and if $n=p$ we would have $b=0$. Hence the only case possible is $n=1$, as required.
