Cody

# Problem 44340. Recaman Sequence - III

Solution 1330619

Submitted on 7 Nov 2017 by David Verrelli
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'))))

id = 2 id = 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'))))

id = 2

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3 id = 5 id = 7 id = 4 id = 6 id = 8 id = 10 id = 5 id = 7 id = 9

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3 id = 5 id = 7 id = 4 id = 6 id = 8 id = 10 id = 5 id = 7 id = 9 id = 11 id = 13

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3 id = 5 id = 7 id = 4 id = 6 id = 8 id = 10 id = 5 id = 7 id = 9 id = 11 id = 13 id = 6 id = 8 id = 10 id = 12 id = 14 id = 16 id = 7 id = 9 id = 11 id = 13 id = 15

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3 id = 5 id = 7 id = 4 id = 6 id = 8 id = 10 id = 5 id = 7 id = 9 id = 11 id = 13 id = 6 id = 8 id = 10 id = 12 id = 14 id = 16 id = 7 id = 9 id = 11 id = 13 id = 15 id = 17 id = 19 id = 8 id = 10 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 9 id = 11 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 10 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3 id = 5 id = 7 id = 4 id = 6 id = 8 id = 10 id = 5 id = 7 id = 9 id = 11 id = 13 id = 6 id = 8 id = 10 id = 12 id = 14 id = 16 id = 7 id = 9 id = 11 id = 13 id = 15 id = 17 id = 19 id = 8 id = 10 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 9 id = 11 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 10 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 11 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54

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'))))

id = 2 id = 1 id = 2 id = 4 id = 3 id = 5 id = 7 id = 4 id = 6 id = 8 id = 10 id = 5 id = 7 id = 9 id = 11 id = 13 id = 6 id = 8 id = 10 id = 12 id = 14 id = 16 id = 7 id = 9 id = 11 id = 13 id = 15 id = 17 id = 19 id = 8 id = 10 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 9 id = 11 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 10 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 11 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 12 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 13 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 14 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 15 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 16 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 17 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 18 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 19 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 20 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 21 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 22 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 23 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 24 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 25 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 69 id = 71 id = 73 id = 26 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 72 id = 74 id = 76 id = 27 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 69 id = 71 id = 73 id = 75 id = 77 id = 79 id = 28 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 72 id = 74 id = 76 id = 78 id = 80 id = 82 id = 29 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 69 id = 71 id = 73 id = 75 id = 77 id = 79 id = 81 id = 83 id = 85 id = 30 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 72 id = 74 id = 76 id = 78 id = 80 id = 82 id = 84 id = 86 id = 88 id = 31 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 69 id = 71 id = 73 id = 75 id = 77 id = 79 id = 81 id = 83 id = 85 id = 87 id = 89 id = 91 id = 32 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 72 id = 74 id = 76 id = 78 id = 80 id = 82 id = 84 id = 86 id = 88 id = 90 id = 92 id = 94 id = 33 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 69 id = 71 id = 73 id = 75 id = 77 id = 79 id = 81 id = 83 id = 85 id = 87 id = 89 id = 91 id = 93 id = 95 id = 97 id = 34 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 72 id = 74 id = 76 id = 78 id = 80 id = 82 id = 84 id = 86 id = 88 id = 90 id = 92 id = 94 id = 96 id = 98 id = 100 id = 35 id = 37 id = 39 id = 41 id = 43 id = 45 id = 47 id = 49 id = 51 id = 53 id = 55 id = 57 id = 59 id = 61 id = 63 id = 65 id = 67 id = 69 id = 71 id = 73 id = 75 id = 77 id = 79 id = 81 id = 83 id = 85 id = 87 id = 89 id = 91 id = 93 id = 95 id = 97 id = 99 id = 101 id = 103 id = 36 id = 38 id = 40 id = 42 id = 44 id = 46 id = 48 id = 50 id = 52 id = 54 id = 56 id = 58 id = 60 id = 62 id = 64 id = 66 id = 68 id = 70 id = 72 id = 74 id = 76 id = 78 id = 80 id = 82 id = 84 id = 86 id = 88 id = 90 id = 92 id = 94 id = 96 id = 98 id = 100 id = 102 id = 104 id = 1...