Problem 52659. Easy Sequences 15: Pythagorean Area with maximum Hypotenuse
From the first test problem, you are missing the triple (9,12,15).
A should be [6; 24; 30; 54; 60; 84; 96] and
B should be [5;10; 13; 15; 17; 25; 20].
Should be OK now. Thanks.
I believe my code should be correct. If you could look at my code, I believe you are missing some triples in other tests as well. I am getting larger values than the test suite and I verified that I don't have any duplicates and the areas are all <= to the input.
I am having the same experience as David, and have also been careful about duplication.
I've checked your solutions and your answers are not the same. I've verified my answers with:
It seems to be OK.
I've added an OEIS link in the problem for reference.
I was confused. I did all possible unique Pythagorean triples (some have the same area). You just want unique areas (and if the areas are the same, the largest hypothenuse). If you added, "unique" areas of all Pythagorean triangles, it would be clearer.
That's why we want to find "largest possible hypotenuse for each area". That doesn't make sense if we don't mean unique areas. Anyway, I changed the problem to make it even clearer. Thanks.
I am now getting the correct A (verified based on OEIS) to 10000, but my max hypotheses must not be matching yours. I verified my code is selecting the maximum hypotheses for the same areas. I don't think I am doing anything wrong.
Hi David, consider your answer for 1,000. If a program is correct the area you will get there should match with OEIS also.
I had a mistake in my code. Figured it out. Thanks.
Problem Recent Solvers7
Create a cell array out of a struct
Self-similarity 2 - Every third term
Find two triangular numbers whose sum is input.
More from this Author102
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!