Solve Euler Project #9 only mathematically - Pythagorean triplet
Hint Euclid's parameterization of the Pythagorean triples (Elements, Book X, Proposition XXIX) is: $$a = k (m^2 - n^2), \qquad b = 2 k m n, \qquad c = k (m^2 + n^2),$$ where $m > n > 0$ and $m, n$ coprime and not both odd.
Substituting in our condition gives $$1000 = a + b + c = 2 k m (m + n),$$ and clearing the constant leaves $$\phantom{(\ast)} \qquad 500 = k m (m + n) . \qquad (\ast)$$ Now, notice that (1) $500 = 2^2 5^3$ has only two distinct prime factors, and (2) since $m$ and $n$ are coprime, so are $m$ and $m + n$.
So, one of $m, m + n$ must be one of $1, 2, 4$ (in fact one of $2, 4$, since $m > n > 0$ implies $m + n > m > 1$) and the other must be one of $1, 5, 25, 125$. Because $m + n > m$, we must have $m \in \{2, 4\}$, and so $m + n < 2 m \leq 8$. Thus, $m + n = 5$, and $2 m > m + n = 5$ implies $m \geq 3$, leaving $m = 4$ as the only possibility. So, $n = 1, k = 25$, and $$\color{#df0000}{\boxed{(a, b, c) = (375, 200, 425)}} .$$
The triplets are all of the form $a=u(n^2-m^2), b=2umn, c=u(n^2+m^2) $ with $n > m$ so $a+b+c =u(2n^2+2mn) =2un(n+m) $.
We must have $n > m$.
Therefore $500 =un(n+m) $.
If $500 = rst $ with $s < t$ then $u = r, n = s, n+m = t $ so $m = t-n =t-s $.
We must have $n > m$ so $s > t-s$ or $s < t < 2s$.
Playing around a bit,
$500 = 1*20*25$, so, swapping $m$ and $n$, $u = 1, m = 5, n=20 $ and the sides are $20^2-5^2 = 375 = 25\ 15, 2\ 20\ 5 = 200 = 25\ 8, 20^2+5^2 = 425 = 25\ 17 $.
It is known that all primitive Pythagorean triples (i.e with no common factors) is of the form $(m^2-n^2,2mn,m^2+n^2)$ for relatively prime $m$ and $n$ where one is even and the other is odd.
Based on that, you are looking for $m$ and $n$ such that $$(m^2-n^2)+2mn+(m^2+n^2)=2m^2+2mn=2m(m+n)$$ is a factor of $1000$.