Problem 2024. Triangle sequence
Solution Stats
Problem Comments

33 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
Solution Comments

1 Comment
tricky

2 Comments
nice
Good problem

2 Comments
Emphasis on the importance of Fibonacci sequence
Right

2 Comments
Great problem. Used a linear algebra approach with this resource:
https://web.media.mit.edu/~holbrow/post/calculatingfibonaccinumberswithmatricesandlinearalgebra/
GOOD question

1 Comment
Nice!

2 Comments
Interesting way to solve
Interesting!

1 Comment
Dear Cody Team,
solutions like mine shall be not allowed.

1 Comment
Elegant brain teaser and a good reminder to always read the question carefully...

2 Comments
And now, nobody will ever see it. You should have, at least, posted it.
Can you please delete this answer?
When I click on "leading solution", I get this solution, which is of no use.

1 Comment
Seems broken, when using Fibonacci ratio it won't work so I have botched it instead

1 Comment
So Exciting !

1 Comment
Finally made it :D ... Fibonacci sequence !

1 Comment
please help me out in understanding the problem

1 Comment
Didn't understand question

1 Comment
Attention to the last line!

1 Comment
Double fibonacci sequence, subtle! I love this problem!

1 Comment
If anyone cares to point out why this is wrong, I'm open to hearing.

1 Comment
Note that the ratio of consecutive areas is asymptotically the golden ratio, i.e., phi=(1+sqrt(5))/2.

1 Comment
Weak! My recursion solution should work just fine, but the server is unable to evaluate it properly. I'm going to count it.

2 Comments
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.

2 Comments
I consider my answer as a cheat
Yeah, you have just copied the required values of the test suits.

3 Comments
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.

1 Comment
yes, this is probably cheating
Problem Recent Solvers3545
Suggested Problems

The Hitchhiker's Guide to MATLAB
3088 Solvers

322 Solvers

434 Solvers

Fahrenheit to Celsius converter
440 Solvers

596 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!