Problem 52819. Easy Sequences 30: Nearly Pythagorean Triangles
A Nearly Pythagorean Triangle (abbreviated as "NPT'), is an integer-sided triangle whose square of the longest side, which we will call as its 'hypotenuse', is 1 more than the sum of square of the shorter sides. This means that if c is the hypotenuse and a and b are the shorter sides,
, satisfies the following equation:
where: 
The smallest
is the triangle
, with
. Other examples are
,
, and
.
Unfortunately, unlike Pythagorean Triangles, a 'closed formula' for generating all possible
's, has not yet been discovered, at the time of this writing. For this exercise, we will be dealing with
's with a known ratio of the shorter sides:
.
Given the value of r, find the
with the second smallest perimeter. For example for
, that is
, the smallest perimeter is
, while the second smallest perimeter is
, for the
with dimensions
. Please present your output as vector
, where a is the smallest side of the
, and c is the hypotenuse.
Solution Stats
Problem Comments
Solution Comments
Show commentsGroup

Programování - Cody
- 12 Problems
- 526 Finishers
- Find the sum of all the numbers of the input vector
- Maximum value in a matrix
- Make the vector [1 2 3 4 5 6 7 8 9 10]
- Return area of square
- Select every other element of a vector
- Triangle Numbers
- Check if number exists in vector
- Create times-tables
- Determine whether a vector is monotonically increasing
- Roll the Dice!
- Verify Law of Large Numbers
- Solve a System of Linear Equations
Problem Recent Solvers19
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!