Problem 2024. Triangle sequence
Solution Stats
Problem Comments

35 Comments
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 email 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.
Very elegantly done!
Very very interesting problem. It introduces the importance of integer sequences.
Why I cannot use the matlab's fibonacci function here? It was Introduced in R2017a. My local PC's matlab and moble matlab can work it out well. Kind of strange.
@Jaya Lee: Cody does not support toolbox functions.
I am so lost
cool
use the concept that area of square is equal to sum of its two previous square.
tried a recursive solution, but it took a long time and finally output a runtime error. Same thing happened on my desktop MATLAB app as well.
Tricky, use the singular size matrix than 2D ;)
very good problem
Modified fibonacci sequence
Advised to carefully read the problem description and notice that the second to last sentence offers a code structure. KR
Solution Comments
Show commentsProblem Recent Solvers4800
Suggested Problems

Find the largest value in the 3D matrix
1483 Solvers

Reverse the elements of an array
995 Solvers

718 Solvers

The sum of the numbers in the vector
583 Solvers

Double all elements in the array
1379 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!