All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Four Triangles (Posted on 2024-05-06) Difficulty: 3 of 5
Rob drew four right-angled triangles. The hypotenuse of his first triangle was also the shortest side of his second triangle; the hypotenuse of his second triangle was also the shortest side of his third triangle; the hypotenuse of his third triangle was also the shortest side of his fourth triangle. The length in millimetres of each side of each triangle was an integer less than 100.

What were the lengths of the shortest and the longest sides that Rob drew?

Note: Adapted from Enigma number 1779 which appeared in New Scientist on 2013.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 7
The code still has some scars from its initial design and debugging statements, but it works:

clearvars,clc
global triangles
triangles=double.empty(0,3);
for st=2:70
  addon(st);
end

function addon(st)
 global triangles
  
  for a=st
    savetri=triangles;
    if size(triangles,1)>=1 && a>st
      break
    end
    save2=triangles;
    for b=a:100
      save2=triangles;
      c=sqrt(a^2+b^2);
      if c>100
        break
      end
      if c~=round(c)
        continue
      end
      if c==85
        xx=99;
      end
      triangles(end+1,:)=[a,b,c];
      if size(triangles,1)>=4
        disp(triangles)
        disp('-----')
      else
          addon(c);
      end
      triangles=save2;
    end
    triangles=savetri;
  end 
end

It finds two paths:

     9    12    15
    15    20    25
    25    60    65
    65    72    97
-----
     9    12    15
    15    36    39
    39    52    65
    65    72    97
-----

  Posted by Charlie on 2024-05-06 09:51:24
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information