Cody

# Problem 1103. Right Triangle Side Lengths (Inspired by Project Euler Problem 39)

Solution 1808880

Submitted on 7 May 2019 by Beatriz Orozco
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
assert(isequal(right_triangle_sides(240),{ [15 112 113] [40 96 104] [48 90 102] [60 80 100] }))

d = [] f = 0×0 empty cell array d = 15 112 113 d = 15 112 113 112 15 113 d = 15 112 113 112 15 113 40 96 104 d = 15 112 113 112 15 113 40 96 104 96 40 104 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 90 48 102 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 90 48 102 60 80 100 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 90 48 102 60 80 100 80 60 100 d = 15 112 113 40 96 104 48 90 102 60 80 100 m = 4 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double} f = 1×3 cell array {1×3 double} {1×3 double} {1×3 double} f = 1×4 cell array {1×3 double} {1×3 double} {1×3 double} {1×3 double}

2   Pass
assert(isequal(right_triangle_sides(240),{ [15 112 113] [40 96 104] [48 90 102] [60 80 100] }))

d = [] f = 0×0 empty cell array d = 15 112 113 d = 15 112 113 112 15 113 d = 15 112 113 112 15 113 40 96 104 d = 15 112 113 112 15 113 40 96 104 96 40 104 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 90 48 102 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 90 48 102 60 80 100 d = 15 112 113 112 15 113 40 96 104 96 40 104 48 90 102 90 48 102 60 80 100 80 60 100 d = 15 112 113 40 96 104 48 90 102 60 80 100 m = 4 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double} f = 1×3 cell array {1×3 double} {1×3 double} {1×3 double} f = 1×4 cell array {1×3 double} {1×3 double} {1×3 double} {1×3 double}

3   Pass
assert(isequal(right_triangle_sides(418),{ [57 176 185] }))

d = [] f = 0×0 empty cell array d = 57 176 185 d = 57 176 185 176 57 185 d = 57 176 185 m = 1 n = 3 f = 1×1 cell array {1×3 double}

4   Pass
assert(isequal(right_triangle_sides(490),{ [140 147 203] }))

d = [] f = 0×0 empty cell array d = 140 147 203 d = 140 147 203 147 140 203 d = 140 147 203 m = 1 n = 3 f = 1×1 cell array {1×3 double}

5   Pass
assert(isequal(right_triangle_sides(112),{ [14 48 50] }))

d = [] f = 0×0 empty cell array d = 14 48 50 d = 14 48 50 48 14 50 d = 14 48 50 m = 1 n = 3 f = 1×1 cell array {1×3 double}

6   Pass
assert(isequal(right_triangle_sides(390),{ [52 165 173] [65 156 169] }))

d = [] f = 0×0 empty cell array d = 52 165 173 d = 52 165 173 165 52 173 d = 52 165 173 165 52 173 65 156 169 d = 52 165 173 165 52 173 65 156 169 156 65 169 d = 52 165 173 65 156 169 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

7   Pass
assert(isequal(right_triangle_sides(132),{ [11 60 61] [33 44 55] }))

d = [] f = 0×0 empty cell array d = 11 60 61 d = 11 60 61 60 11 61 d = 11 60 61 60 11 61 33 44 55 d = 11 60 61 60 11 61 33 44 55 44 33 55 d = 11 60 61 33 44 55 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

8   Pass
assert(isequal(right_triangle_sides(576),{ [64 252 260] [144 192 240] }))

d = [] f = 0×0 empty cell array d = 64 252 260 d = 64 252 260 252 64 260 d = 64 252 260 252 64 260 144 192 240 d = 64 252 260 252 64 260 144 192 240 192 144 240 d = 64 252 260 144 192 240 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

9   Pass
assert(isequal(right_triangle_sides(60),{ [10 24 26] [15 20 25] }))

d = [] f = 0×0 empty cell array d = 10 24 26 d = 10 24 26 24 10 26 d = 10 24 26 24 10 26 15 20 25 d = 10 24 26 24 10 26 15 20 25 20 15 25 d = 10 24 26 15 20 25 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

10   Pass
assert(isequal(right_triangle_sides(650),{ [25 312 313] }))

d = [] f = 0×0 empty cell array d = 25 312 313 d = 25 312 313 312 25 313 d = 25 312 313 m = 1 n = 3 f = 1×1 cell array {1×3 double}

11   Pass
assert(isequal(right_triangle_sides(732),{ [183 244 305] }))

d = [] f = 0×0 empty cell array d = 183 244 305 d = 183 244 305 244 183 305 d = 183 244 305 m = 1 n = 3 f = 1×1 cell array {1×3 double}

12   Pass
assert(isequal(right_triangle_sides(648),{ [162 216 270] }))

d = [] f = 0×0 empty cell array d = 162 216 270 d = 162 216 270 216 162 270 d = 162 216 270 m = 1 n = 3 f = 1×1 cell array {1×3 double}

13   Pass
assert(isequal(right_triangle_sides(930),{ [155 372 403] }))

d = [] f = 0×0 empty cell array d = 155 372 403 d = 155 372 403 372 155 403 d = 155 372 403 m = 1 n = 3 f = 1×1 cell array {1×3 double}

14   Pass
assert(isequal(right_triangle_sides(876),{ [219 292 365] }))

d = [] f = 0×0 empty cell array d = 219 292 365 d = 219 292 365 292 219 365 d = 219 292 365 m = 1 n = 3 f = 1×1 cell array {1×3 double}

15   Pass
assert(isequal(right_triangle_sides(588),{ [84 245 259] [147 196 245] }))

d = [] f = 0×0 empty cell array d = 84 245 259 d = 84 245 259 245 84 259 d = 84 245 259 245 84 259 147 196 245 d = 84 245 259 245 84 259 147 196 245 196 147 245 d = 84 245 259 147 196 245 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

16   Pass
assert(isequal(right_triangle_sides(208),{ [39 80 89] }))

d = [] f = 0×0 empty cell array d = 39 80 89 d = 39 80 89 80 39 89 d = 39 80 89 m = 1 n = 3 f = 1×1 cell array {1×3 double}

17   Pass
assert(isequal(right_triangle_sides(228),{ [57 76 95] }))

d = [] f = 0×0 empty cell array d = 57 76 95 d = 57 76 95 76 57 95 d = 57 76 95 m = 1 n = 3 f = 1×1 cell array {1×3 double}

18   Pass
assert(isequal(right_triangle_sides(312),{ [24 143 145] [78 104 130] }))

d = [] f = 0×0 empty cell array d = 24 143 145 d = 24 143 145 143 24 145 d = 24 143 145 143 24 145 78 104 130 d = 24 143 145 143 24 145 78 104 130 104 78 130 d = 24 143 145 78 104 130 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

19   Pass
assert(isequal(right_triangle_sides(924),{ [42 440 442] [77 420 427] [132 385 407] [198 336 390] [231 308 385] }))

d = [] f = 0×0 empty cell array d = 42 440 442 d = 42 440 442 440 42 442 d = 42 440 442 440 42 442 77 420 427 d = 42 440 442 440 42 442 77 420 427 420 77 427 d = 42 440 442 440 42 442 77 420 427 420 77 427 132 385 407 d = 42 440 442 440 42 442 77 420 427 420 77 427 132 385 407 385 132 407 d = 42 440 442 440 42 442 77 420 427 420 77 427 132 385 407 385 132 407 198 336 390 d = 42 440 442 440 42 442 77 420 427 420 77 427 132 385 407 385 132 407 198 336 390 336 198 390 d = 42 440 442 440 42 442 77 420 427 420 77 427 132 385 407 385 132 407 198 336 390 336 198 390 231 308 385 d = 42 440 442 440 42 442 77 420 427 420 77 427 132 385 407 385 132 407 198 336 390 336 198 390 231 308 385 308 231 385 d = 42 440 442 77 420 427 132 385 407 198 336 390 231 308 385 m = 5 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double} f = 1×3 cell array {1×3 double} {1×3 double} {1×3 double} f = 1×4 cell array {1×3 double} {1×3 double} {1×3 double} {1×3 double} f = 1×5 cell array {1×3 double} {1×3 double} {1×3 double} {1×3 double} {1×3 double}

20   Pass
assert(isequal(right_triangle_sides(980),{ [280 294 406] }))

d = [] f = 0×0 empty cell array d = 280 294 406 d = 280 294 406 294 280 406 d = 280 294 406 m = 1 n = 3 f = 1×1 cell array {1×3 double}

21   Pass
assert(isequal(right_triangle_sides(112),{ [14 48 50] }))

d = [] f = 0×0 empty cell array d = 14 48 50 d = 14 48 50 48 14 50 d = 14 48 50 m = 1 n = 3 f = 1×1 cell array {1×3 double}

22   Pass
assert(isequal(right_triangle_sides(30),{ [5 12 13] }))

d = [] f = 0×0 empty cell array d = 5 12 13 d = 5 12 13 12 5 13 d = 5 12 13 m = 1 n = 3 f = 1×1 cell array {1×3 double}

23   Pass
assert(isequal(right_triangle_sides(680),{ [102 280 298] [136 255 289] }))

d = [] f = 0×0 empty cell array d = 102 280 298 d = 102 280 298 280 102 298 d = 102 280 298 280 102 298 136 255 289 d = 102 280 298 280 102 298 136 255 289 255 136 289 d = 102 280 298 136 255 289 m = 2 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double}

24   Pass
assert(isequal(right_triangle_sides(396),{ [33 180 183] [72 154 170] [99 132 165] }))

d = [] f = 0×0 empty cell array d = 33 180 183 d = 33 180 183 180 33 183 d = 33 180 183 180 33 183 72 154 170 d = 33 180 183 180 33 183 72 154 170 154 72 170 d = 33 180 183 180 33 183 72 154 170 154 72 170 99 132 165 d = 33 180 183 180 33 183 72 154 170 154 72 170 99 132 165 132 99 165 d = 33 180 183 72 154 170 99 132 165 m = 3 n = 3 f = 1×1 cell array {1×3 double} f = 1×2 cell array {1×3 double} {1×3 double} f = 1×3 cell array {1×3 double} {1×3 double} {1×3 double}

25   Pass
assert(isequal(right_triangle_sides(988),{ [266 312 410] }))

d = [] f = 0×0 empty cell array d = 266 312 410 d = 266 312 410 312 266 410 d = 266 312 410 m = 1 n = 3 f = 1×1 cell array {1×3 double}