Problem 313. Pythagorean perfect squares: find the square of the hypotenuse and the length of the other side

Given the square root of a square number, seed, and a range, n, find the square number, Z as well as the other side, y, the square root of a square number i.e. return the hypotenuse squared as well as the length of the other side. Note that n is the number of squares to search through starting with one.

HINT: Z = seed^2 + y^2 where Z = z^2, find Z first and then y.

Note that Z, seed^2 and y^2 are all perfect squares.

>> [z s] = findPerfectZ(3,6)

z = 25

s = 4

>>

Solution Stats

47.2% Correct | 52.8% Incorrect
Last Solution submitted on Dec 03, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers55

Suggested Problems

More from this Author16

Problem Tags

Community Treasure Hunt

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

Start Hunting!