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.
Which values occur exactly three times?
Back to basics 10 - Max Float
Piecewise linear interpolation
Easy Sequences 51: Positive Gaussian Primes
Easy Sequences 25: Product of Series
Easy Sequences 10: Sum of Cumsums of Fibonacci Sequence
Easy Sequences 52: Non-squarable Rectangles
Easy Sequences 41: Boxes with Integer Edges
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office