Cody

Solution 1556674

Submitted on 11 Jun 2018 by gregory kaprov
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))

v = 3 4 5 mat = 3 4 5 v = 5 12 13 mat = 3 4 5 5 12 13 v = 6 8 10 mat = 3 4 5 5 12 13 6 8 10 v = 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))

v = 3 4 5 mat = 3 4 5 v = 5 12 13 mat = 3 4 5 5 12 13 v = 6 8 10 mat = 3 4 5 5 12 13 6 8 10 v = 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))

v = 3 4 5 mat = 3 4 5 v = 5 12 13 mat = 3 4 5 5 12 13 v = 6 8 10 mat = 3 4 5 5 12 13 6 8 10 v = 7 24 25 mat = 3 4 5 5 12 13 6 8 10 7 24 25 v = 8 15 17 mat = 3 4 5 5 12 13 6 8 10 7 24 25 8 15 17 v = 9 12 15 mat = 3 4 5 5 12 13 6 8 10 7 24 25 8 15 17 9 12 15 v = 9 40 41 mat = 3 4 5 5 12 13 6 8 10 7 24 25 8 15 17 9 12 15 9 40 41 v = 10 24 26 mat = 3 4 5 5 12 13 6 8 10 7 24 25 8 15 17 9 12 15 9 40 41 10 24 26 v = 11 60 61 mat = 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 v = 12 16 20 mat = 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 v = 12 35 37 mat = 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 v = 13 84 85 mat = 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 v = 14 48 50 mat = 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 v = 15 20 25 mat = 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 v = 15 36 39 mat = 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 v = 15 112 113 mat = 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 15 112 113 v = 16 30 34 mat = 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 15 112 113 16 30 34 v = 16 63 65 mat = 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 15 112 113 16 30 34 16 63 65 v = 17 144 145 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 v = 18 24 30 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 v = 18 80 82 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 v = 19 180 181 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 v = 20 21 29 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 v = 20 48 52 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 v = 20 99 101 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 20 99 101 v = 21 28 35 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 20 99 101 21 28 35 v = 21 72 75 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 20 99 101 21 28 35 21 72 75 v = 21 220 221 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 20 99 101 21 28 35 21 72 75 21 220 221 v = 22 120 122 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 20 99 101 21 28 35 21 72 75 21 220 221 22 120 122 v = 23 264 265 mat = 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 15 112 113 16 30 34 16 63 65 17 144 145 18 24 30 18 80 82 19 180 181 20 21 29 20 48 52 20 99 101 21 28 35 21 72 75 21 220 221 22 120 122 23 264 265 v = 24 32 40 mat = 3 4 5 5 12 13 6 8 10 7 24 25 8...