A sequence of triangles is constructed in the following way:
1) the first triangle is Pythagoras' 3-4-5 triangle
2) the second triangle is a right-angle triangle whose second longest side is the hypotenuse of the first triangle, and whose shortest side is the same length as the second longest side of the first triangle
3) the third triangle is a right-angle triangle whose second longest side is the hypotenuse of the second triangle, and whose shortest side is the same length as the second longest side of the second triangle etc.
Each triangle in the sequence is constructed so that its second longest side is the hypotenuse of the previous triangle and its shortest side is the same length as the second longest side of the previous triangle.
What is the area of a square whose side is the hypotenuse of the nth triangle in the sequence?
good for brain !
The best problem of the CUP challenge.
I think that thematic challenge is a wonderful idea. I solved this one with a great pleasure.
Great problem. So many ways to solve it. It was fun trying different methods to see which scored the best.
The connection of this problem with the Fibonacci sequence is most interesting.
indeed: like!
Very interesting problem!
Interesting problem....!
Interesting!!
Good one :)
Combining the Fibonacci sequence and the Pythagorean theorem is a nice idea
I thought I had the right code and it didn't work. Then I realized that the area of the first triangle (n=1 case) should be 0.5*4*3 = 6. But is given in the solution as 25. Am I understanding this wrong? I thought the three sides of the first triangle (n=1) was 3,4,5 and we go on from there. Please let me know if my understanding is wrong and then I can proceed Otherwise I have a general code.
@ Dhaval: Try reading the last sentence of the problem very carefully.
@Milan Petrovic: Thank you, I completely missed that; silly me. Now I got it to work :)
Good problem. Kinda fun too.
Definitely needed to read that last line carefully. Like at least one other here, I misread it.
can someone help me with this problem?
tough but fun... had issues with assertion at first through
Does Cody not recognize the Fibonacci function?
Can anybody PLEASE send me the solution of this problem? My e-mail is: anthonydavid72@hotmail.com
so interesting!
Nice one! Makes you think, and then the solution is simple and elegant.
It was a really great problem to solve. For me doing the steps as mentioned on paper helped a lot for proper visualization of the problem, and to understand the flow.
Thanks Tanya Morton for the problem exercise.
Dear Cody Team,
solutions like mine shall be not allowed.
Elegant brain teaser and a good reminder to always read the question carefully...
Seems broken, when using Fibonacci ratio it won't work so I have botched it instead
So Exciting !
Finally made it :D ... Fibonacci sequence !
please help me out in understanding the problem
Didn't understand question
very hard example
R_T=[3 4 5];
if (n>1)
for i=1:(n-1)
R_T=[R_T(2) R_T(3) (R_T(2)^2+R_T(3)^2)^0.5]
Attention to the last line!
Double fibonacci sequence, subtle! I love this problem!
If anyone cares to point out why this is wrong, I'm open to hearing.
Note that the ratio of consecutive areas is asymptotically the golden ratio, i.e., phi=(1+sqrt(5))/2.
Weak! My recursion solution should work just fine, but the server is unable to evaluate it properly. I'm going to count it.
Its the best way that I found :)
I think it is the only way to solve this Problem. We Need to get the sides of nth triangle and ist done.
I consider my answer as a cheat
Interesting... (not a reflection on this particular solution but cody in general) - most of the lowest scored answers could be entries in an "obfuscated code" contest.
I'm curious how all these "Size 10" solutions look like. I don't get even close to this value. I terms of education, it would be great to see example codes which are able to go this low.
Brilliant !
I join you @Eugen, it would be great to share some "Size 10" solutions samples.
yes, this is probably cheating
2326 Solvers
Basic electricity in a dry situation
448 Solvers
388 Solvers
Rounding off numbers to n decimals
293 Solvers
Is this is a Tic Tac Toe X Win?
377 Solvers