Cody

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

Solution 684123

Submitted on 9 Jun 2015 by Zikobrelli
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% seed=3;n=6; [Z,y] = findPerfectZ(seed,n); Z_correct = 25; y_correct = 4; assert(isequal(Z,Z_correct)); assert(isequal(y,y_correct));

A = 3.1623 3.6056 4.2426 5.0000 5.8310 6.7082 y = 4 Z = 25

2   Pass
%% seed=5;n=15; [Z,y] = findPerfectZ(seed,n); Z_correct = 169; y_correct = 12; assert(isequal(Z,Z_correct)); assert(isequal(y,y_correct));

A = 5.0990 5.3852 5.8310 6.4031 7.0711 7.8102 8.6023 9.4340 10.2956 11.1803 12.0830 13.0000 13.9284 14.8661 15.8114 y = 12 Z = 169

3   Pass
%% seed=4;n=6; [Z,y] = findPerfectZ(seed,n); Z_correct = 25; y_correct = 3; assert(isequal(Z,Z_correct)); assert(isequal(y,y_correct));

A = 4.1231 4.4721 5.0000 5.6569 6.4031 7.2111 y = 3 Z = 25

4   Pass
%% seed=12;n=15; [Z,y] = findPerfectZ(seed,n); Z_correct = 169; y_correct = 5; assert(isequal(Z,Z_correct)); assert(isequal(y,y_correct));

A = 12.0416 12.1655 12.3693 12.6491 13.0000 13.4164 13.8924 14.4222 15.0000 15.6205 16.2788 16.9706 17.6918 18.4391 19.2094 y = 5 Z = 169

5   Pass
%% seed=6;n=9; [Z,y] = findPerfectZ(seed,n); Z_correct = 100; y_correct = 8; assert(isequal(Z,Z_correct)); assert(isequal(y,y_correct));

A = 6.0828 6.3246 6.7082 7.2111 7.8102 8.4853 9.2195 10.0000 10.8167 y = 8 Z = 100

6   Pass
%% seed=8;n=9; [Z,y] = findPerfectZ(seed,n); Z_correct = 100; y_correct = 6; assert(isequal(Z,Z_correct)); assert(isequal(y,y_correct));

A = 8.0623 8.2462 8.5440 8.9443 9.4340 10.0000 10.6301 11.3137 12.0416 y = 6 Z = 100