Le Monde puzzle [#1062]

lemondapariA simple Le Monde mathematical puzzle none too geometric:

  1. Find square triangles which sides are all integers and which surface is its perimeter.
  2. 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

2 Responses to “Le Monde puzzle [#1062]”

  1. Rajendra Bajpai Says:

    The solution is incorrect. The sum of two sides of a triangle is always greater than the third side. The solutions (4 , 5,21) , ( 5,9,16) and (6,7,15) do not form triangles. Replace the for loop for z by for (z in b:(a+b-1))

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.