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].
NOTE: Please check this link for reference: https://oeis.org/A009112.

Solution Stats

29 Solutions

9 Solvers

Last Solution submitted on Dec 02, 2025

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers9

Suggested Problems

More from this Author116

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!