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.
Vectorize the digits of an Integer
Add two numbers
Multiples of a Number in a Given Range
Easy Sequences 32: Almost Pythagorean Triples
Easy Sequences 13: Average Speed of Spaceship
Easy Sequences 35: Cutting a donut to Semi-prime pieces
Easy Sequences 46: Semi-prime Leap Year Pairs
Easy Sequences 24: Number of Coprime Lattice Points
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