Cody

Solution 1556589

Submitted on 11 Jun 2018 by yuri pahomov
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
filetext = fileread('triples.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
n = 1; mat_correct = []; assert(isequal(triples(n),mat_correct))

mat = []

3   Pass
n = 20.5; mat_correct = []; assert(isequal(triples(n),mat_correct))

mat = []

4   Pass
n = 15; mat_correct = [3, 4, 5; 5, 12, 13; 6, 8, 10; 9, 12, 15]; assert(isequal(triples(n),mat_correct))

K = 3 4 5 3 4 5 5 12 13 6 8 10 6 8 10 9 12 15 5 12 13 9 12 15 mat = 3 4 5 5 12 13 6 8 10 9 12 15

5   Pass
n = 16; mat_correct = [3, 4, 5; 5, 12, 13; 6, 8, 10; 9, 12, 15]; assert(isequal(triples(n),mat_correct))

K = 3 4 5 3 4 5 5 12 13 6 8 10 6 8 10 9 12 15 5 12 13 9 12 15 mat = 3 4 5 5 12 13 6 8 10 9 12 15

6   Pass
n = 100 mat_correct = ... [3 4 5; 5 12 13; 6 8 10; 7 24 25; 8 15 17; 9 12 15; 9 40 41; 10 24 26; 11 60 61; 12 16 20; 12 35 37; 13 84 85; 14 48 50; 15 20 25; 15 36 39; 16 30 34; 16 63 65; 18 24 30; 18 80 82; 20 21 29; 20 48 52; 21 28 35; 21 72 75; 24 32 40; 24 45 51; 24 70 74; 25 60 65; 27 36 45; 28 45 53; 28 96 100; 30 40 50; 30 72 78; 32 60 68; 33 44 55; 33 56 65; 35 84 91; 36 48 60; 36 77 85; 39 52 65; 39 80 89; 40 42 58; 40 75 85; 42 56 70; 45 60 75; 48 55 73; 48 64 80; 51 68 85; 54 72 90; 57 76 95; 60 63 87; 60 80 100; 65 72 97];

n = 100

7   Pass
n = 1000; s_correct = [881, 3]; assert(isequal(size(triples(n)), s_correct))

K = 3 4 5 3 4 5 5 12 13 6 8 10 7 24 25 6 8 10 8 15 17 9 12 15 9 40 41 10 24 26 11 60 61 5 12 13 9 12 15 12 16 20 12 35 37 13 84 85 14 48 50 8 15 17 15 20 25 15 36 39 15 112 113 12 16 20 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 15 20 25 20 21 29 20 48 52 20 99 101 20 21 29 21 28 35 21 72 75 21 220 221 22 120 122 23 264 265 7 24 25 10 24 26 18 24 30 24 32 40 24 45 51 24 70 74 24 143 145 25 60 65 25 312 313 26 168 170 27 36 45 27 120 123 27 364 365 21 28 35 28 45 53 28 96 100 28 195 197 29 420 421 16 30 34 30 40 50 30 72 78 30 224 226 31 480 481 24 32 40 32 60 68 32 126 130 32 255 257 33 44 55 33 56 65 33 180 183 33 544 545 34 288 290 12 35 37 35 84 91 35 120 125 35 612 613 15 36 39 27 36 45 36 48 60 36 77 85 36 105 111 36 160 164 36 323 325 37 684 685 38 360 362 39 52 65 39 80 89 39 252 255 39 760 761 9 40 41 30 40 50 40 42 58 40 75 85 40 96 104 40 198 202 40 399 401 41 840 841 40 42 58 42 56 70 42 144 150 42 440 442 43 924 925 33 44 55 44 117 125 44 240 244 44 483 485 24 45 51 28 45 53 45 60 75 45 108 117 45 200 205 45 336 339 46 528 530 14 48 50 20 48 52 36 48 60 48 55 73 48 64 80 48 90 102 48 140 148 48 189 195 48 286 290 48 575 577 49 168 175 50 120 130 50 624 626 51 68 85 51 140 149 51 432 435 39 52 65 52 165 173 52 336 340 52 675 677 54 72 90 54 240 246 54 728 730 48 55 73 55 132 143 55 300 305 33 56 65 42 56 70 56 90 106 56 105 119 56 192 200 56 390 394 56 783 785 57 76 95 57 176 185 57 540 543 58 840 842 11 60 61 25 60 65 32 60 68 45 60 75 60 63 87 60 80 100 60 91 109 60 144 156 60 175 185 60 221 229 60 297 303 60 448 452 60 899 901 62 960 962 16 63 65 60 63 87 63 84 105 63 216 225 63 280 287 63 660 663 48 64 80 64 120 136 64 252 260 64 510 514 65 72 97 65 156 169 65 420 425 66 88 110 66 112 130 66 360 366 51 68 85 68 285 293 68 576 580 69 92 115 69 260 269 69 792 795 24 70 74 70 168 182 70 240 250 21 72 75 30 72 78 54 72 90 65 72 97 72 96 120 72 135 153 72 154 170 72 210 222 72 320 328 72 429 435 72 646 650 40 75 85 75 100 125 75 180 195 75 308 317 75 560 565 75 936 939 57 76 95 76 357 365 76 720 724 36 77 85 77 264 275 77 420 427 78 104 130 78 160 178 78 504 510 18 80 82 39 80 89 60 80 100 80 84 116 80 150 170 80 192 208 80 315 325 80 396 404 80 798 802 81 108 135 81 360 369 13 84 85 35 84 91 63 84 105 80 84 116 84 112 140 84 135 159 84 187 205 84 245 259 84 288 300 84 437 445 84 585 591 84 880 884 85 132 157 85 204 221 85 720 725 87 116 145 87 416 425 66 88 110 88 105 137 88 165 187 88 234 250 88 480 488 88 966 970 48 90 102 56 90 106 90 120 150 90 216 234 90 400 410 90 672 678 60 91 109 91 312 325 91 588 595 69 92 115 92 525 533 93 124 155 93 476 485 95 168 193 95 228 247 95 900 905 28 96 100 40 96 104 72 96 120 96 110 146 96 128 160 96 180 204 96 247 265 ...