Cody

Problem 44340. Recaman Sequence - III

Solution 1392868

Submitted on 25 Dec 2017 by suyako
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
x = 1; y_correct = 1; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = 1

2   Pass
x = 2; y_correct = 0; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

3   Pass
x = 3; y_correct = 4; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = 1 3 4

4   Pass
x = 9; y_correct = 13; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = 1 9 2 8 3 7 10 12 13

5   Pass
x = 13; y_correct = 15; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = 1 13 2 12 3 11 4 10 5 9 12 14 15

6   Pass
x = 15; y_correct = 26; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = 1 15 2 14 3 13 4 12 5 11 16 20 23 25 26

7   Pass
x = 26; y_correct = 54; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = 1 26 2 25 3 24 4 23 5 22 6 21 7 20 8 19 9 18 26 33 39 44 48 51 53 54

8   Pass
x = 54; y_correct = 208; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = Columns 1 through 29 1 54 2 53 3 52 4 51 5 50 6 49 7 48 8 47 9 46 10 45 11 44 12 43 13 42 14 41 15 Columns 30 through 54 40 16 39 17 38 18 37 55 72 88 103 117 130 142 153 163 172 180 187 193 198 202 205 207 208

9   Pass
x = 208; y_correct = 2485; assert(isequal(RecamanIII(x),y_correct)) assert(~any(cellfun(@(x)ismember(max([0,str2num(x)]),[13 15 26 54 208 2485]),regexp(fileread('RecamanIII.m'),'[\d\.\+\-\*\/]+','match'))))

t = Columns 1 through 14 1 208 2 207 3 206 4 205 5 204 6 203 7 202 Columns 15 through 28 8 201 9 200 10 199 11 198 12 197 13 196 14 195 Columns 29 through 42 15 194 16 193 17 192 18 191 19 190 20 189 21 188 Columns 43 through 56 22 187 23 186 24 185 25 184 26 183 27 182 28 181 Columns 57 through 70 29 180 30 179 31 178 32 177 33 176 34 175 35 174 Columns 71 through 84 36 173 37 172 38 171 39 170 40 169 41 168 42 167 Columns 85 through 98 43 166 44 165 45 164 46 163 47 162 48 161 49 160 Columns 99 through 112 50 159 51 158 52 157 53 156 54 155 55 154 56 153 Columns 113 through 126 57 152 58 151 59 150 60 149 61 148 62 147 63 146 Columns 127 through 140 64 145 65 144 66 143 67 142 68 141 69 140 70 139 Columns 141 through 154 207 274 340 405 469 532 594 655 715 774 832 889 945 1000 Columns 155 through 168 1054 1107 1159 1210 1260 1309 1357 1404 1450 1495 1539 1582 1624 1665 Columns 169 through 182 1705 1744 1782 1819 1855 1890 1924 1957 1989 2020 2050 2079 2107 2134 Columns 183 through 196 2160 2185 2209 2232 2254 2275 2295 2314 2332 2349 2365 2380 2394 2407 Columns 197 through 208 2419 2430 2440 2449 2457 2464 2470 2475 2479 2482 2484 2485