4. In a right-angled triangle, the lengths of all sides are natural numbers, with one of the legs equal to 2012.

a) (7th grade) Find at least one such triangle.

b) (8th-9th grades) Find all such triangles. Answer: b) $(2012,253005,253013); (2012,506016, 506020); (2012,1012035,1012037)$ and $(2012,1509,2515)$.
# Solution.

Let's solve the equation $x^{2}+2012^{2}=y^{2}$ in natural numbers. $2012^{2}=y^{2}-x^{2}=(y-x) \cdot(y+x)$. Factorize $2012^{2}=2^{4} \cdot 503^{2}$. Note that $y-x<y+x$ and these two numbers $(x+y$ and $y-x)$ must both be even. That is, the twos must be present in the factorization of both numbers. In addition, 503 must be present in the first number in the first or second power. We get the following options: $\left\{\begin{array}{l}y+x=503^{2} \cdot 2 \\ y-x=2^{3}\end{array} ;\left\{\begin{array}{l}y+x=503^{2} \cdot 2^{2} \\ y-x=2^{2}\end{array} ;\left\{\begin{array}{l}y+x=503^{2} \cdot 2^{3} \\ y-x=2\end{array} ;\left\{\begin{array}{l}y+x=503 \cdot 2^{3} \\ y-x=503 \cdot 2\end{array} ;\right.\right.\right.\right.$

Solving the obtained systems, we get the answers: $(253005,253013) ;(506016,506020)(1012035,1012037)$ and $(1509,2515)$.