**A** simple Le Monde mathematical puzzle none too geometric:

*Find square triangles which sides are all integers and which surface is its perimeter.**Extend to non-square rectangles.*

No visible difficulty by virtue of Pythagore’s formula:

for (a in 1:1e4) for (b in a:1e4) if (a*b==2*(a+b+round(sqrt(a*a+b*b)))) print(c(a,b))

produces two answers

5 12 6 8

and in the more general case, Heron’s formula to the rescue!,

for (a in 1:1e2) for (b in a:1e2) for (z in b:1e2){ s=(a+b+z)/2 if (abs(4*s-abs((s-a)*(s-b)*(s-z)))<1e-4) print(c(a,b,z))}

returns

4 15 21 5 9 16 5 12 13 6 7 15 6 8 10 6 25 29 7 15 20 9 10 17