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: ![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHwAAAAkCAYAAABLw14kAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAfKADAAQAAAABAAAAJAAAAACGCVDrAAAGJElEQVR4Ae2ZeYiVVRiHzdyymrLMHHOMrHCphrCRFFouQYmmE05kRGVFtCJTCglpRmmhkgRtlBViu60WVmKkRbZHVi6Z/TOTpZlZZjqZudTzu30vHO58V7/tOl9xfvDMOfcs7znnPeu9066dl/eA94D3gPeA94D3gPeA94D3gPdAvjxwQL66U9He1GK9HxwPA2AgXAZrwOt/6IGnGNNq+DtgO2Fn8MqxB7rTtzsg6URVUdcmfAlxr5x6oCf9mgXbQBN2MCTRUCrZhE9KYsDXqawHajD/AOj4tYn6iXjSHT7FsVNHPA/Su+LQPHSkLftwHI0/CjvAJnoD8QnQFZLqPSrK3iZon9RIRvVOwc482A2jMrL5nzOj1f4E7ASb6B+Jj4eDII20i8zuc2kMpax7GvXnwx6wMY5MaTNy9Q4RS3aiXD3oq4122MuwEUZDL7gTtkBSnUzFyTAGbOdpR8+E2aAjPa0KGLDxvhUYqyZsAH1V2wzPw7dQCen9oCtluGN8BfGp8IaTliSqzTAIND8nwHLQGLVZYutCaqiiVqSOxFfgd1gJWqG/woGQROqk7LmrfT2fb4IukKX0FrAddQxxtdHipClPj0J9N89SBYwtBmtb4Vcgv6b9HUT1x8IPoA33LNwO8qF8einE0i2UVkXdeVo9pklEbAAvWWKMcAhltarNhsJ10AhZTzQmi/qGv2pnFUwE3Z0PwxXwKlhffiFupwzRxBpGzaVgdhV+CQ2Q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QSaufrrRVJcqQqut+Pm/jcENTuS2iNyWF6pORZR9O5uaDdoMldDltAd+tCOBPaQj1odAZow8ifoyCqdCJo0WgMNhcK9dDV7xgdoazK7ZQTqXESNMMqkMNMA4hUwyegh1AcaScNhbQ76gNs6NSJqioKakw18DOsgU3Q1upGBxphEXwcszMa02DQbwbafCtAx32udDa9cVdl0njUOzxXg89DZ9LutLhjyKI9LRIdZ14JPFDuSE9gKlIV3S86xtJIR3kejuM0Y/B1vQe8B7wHvAe8B7wHvAe8B7wHynvgH4lSu2bF02PbAAAAAElFTkSuQmCC)
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 commentsProblem Recent Solvers19
Suggested Problems
-
The Hitchhiker's Guide to MATLAB
3281 Solvers
-
Determine the number of odd integers in a vector
709 Solvers
-
99 Solvers
-
Lateral Area of a Right Rectangular Pyramid
31 Solvers
-
Easy Sequences 34: Modified Pascal's Triangle
8 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!