Problem 52659. Easy Sequences 15: Pythagorean Area with maximum Hypotenuse
A pythagorean triangle is defined as a right triangle with all three sides having integer lengths. Examples of pythogorean triangles are [3 4 5], [6 8 10] and [5 12 13].
For a given a limit 'n', 2 vectors are produced: 'A' and 'H', 'A' contains all unique areas of pythagorean triangles, less than or equal to 'n', while 'H' contains the largest possible hypotenuse for each area in 'A'. Write a function with 2 outputs , 'a' and 'h', which are sums of the elements of 'A' and 'H', respectively.
For example for n = 100, the produced vectors are: A = [6; 24; 30; 54; 60; 84; 96] and B = [5;10; 13; 15; 17; 25; 20].
Therefore, the output shall be: [a h] = [354 105].
Solution Stats
Problem Comments
-
11 Comments
Show
8 older comments
David Hill
on 9 Sep 2021
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.
Ramon Villamangca
on 9 Sep 2021
Hi David, consider your answer for 1,000. If a program is correct the area you will get there should match with OEIS also.
David Hill
on 9 Sep 2021
I had a mistake in my code. Figured it out. Thanks.
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
2545 Solvers
-
Find state names that start with the letter N
1306 Solvers
-
17199 Solvers
-
182 Solvers
-
Pandigital number n°2 (Inspired by Project Euler 32)
61 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!