Cody

# Problem 711. What digit is it?

Solution 463492

Submitted on 27 Jun 2014 by James
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
%% n=3; x=7; q=2; y_correct = 1; assert(isequal(whatdigit(n,x,q),y_correct))

a = 2 1 8 7

2   Pass
%% n=5; x=5; q=3; y_correct = 2; assert(isequal(whatdigit(n,x,q),y_correct))

a = 3 1 2 5

3   Pass
%% n=7; x=7; q=3; y_correct = 3; assert(isequal(whatdigit(n,x,q),y_correct))

a = 1 1 7 6 4 9 a = 8 2 3 5 4 3

4   Pass
%% n=21; x=17; q=18; y_correct = 8; assert(isequal(whatdigit(n,x,q),y_correct))

a = 1 8 13 14 8 1 a = 1 6 18 19 19 18 8 5 4 1 a = 1 4 25 17 8 18 8 0 8 16 16 21 10 1 a = Columns 1 through 16 1 4 13 13 15 21 12 16 17 7 3 7 19 20 18 14 Columns 17 through 18 6 1 a = Columns 1 through 16 1 2 22 10 5 6 8 5 17 18 21 12 20 19 7 13 Columns 17 through 22 22 12 8 3 2 1 a = Columns 1 through 16 3 0 0 4 1 9 4 2 4 9 5 0 8 1 6 9 Columns 17 through 23 1 8 9 4 7 4 1

5   Pass
%% n=201; x=123; q=241; y_correct = 7; assert(isequal(whatdigit(n,x,q),y_correct))

a = 2 0 1 a = 4 0 2 20 1 a = 8 0 4 80 4 20 1 a = 16 0 28 41 2 120 6 20 1 a = 1 6 0 28 41 2 120 6 20 1 a = 2 0 121 66 43 42 82 4 160 8 20 1 a = 6 0 43 162 8 160 8 80 4 20 1 0 20 1 a = 12 0 106 185 89 84 24 121 6 120 6 20 41 2 20 1 a = Columns 1 through 16 1 2 0 106 185 89 84 24 121 6 120 6 20 41 2 20 Column 17 1 a = Columns 1 through 16 2 0 61 43 102 85 144 147 127 46 162 8 160 88 24 81 Columns 17 through 19 4 20 1 a = Columns 1 through 16 4 0 122 126 86 44 22 1 0 60 43 82 84 184 29 41 Columns 17 through 21 22 121 6 20 1 a = Columns 1 through 16 10 0 65 103 105 5 120 46 22 121 106 45 42 42 142 67 Columns 17 through 23 83 84 24 161 8 20 1 a = Columns 1 through 16 1 0 0 65 103 105 5 120 46 22 121 106 45 42 42 142 Columns 17 through 24 67 83 84 24 161 8 20 1 a = Columns 1 through 16 2 0 1 140 127 66 123 146 87 184 109 45 2 180 149 127 Columns 17 through 26 186 129 26 161 8 40 2 0 20 1 a = Columns 1 through 16 4 0 22 121 66 83 184 169 128 126 106 65 143 27 121 66 Columns 17 through 28 123 186 69 43 42 42 2 40 42 2 20 1 a = Columns 1 through 16 8 0 64 83 164 128 66 43 62 23 141 67 183 129 186 189 Columns 17 through 30 9 40 62 63 143 127 46 122 86 44 82 4 20 1 a = Columns 1 through 16 16 0 148 87 4 140 107 5 180 109 145 187 129 146 187 109 Columns 17 through 32 5 60 123 186 169 128 46 182 29 21 41 42 122 6 20 1 a = Columns 1 through 16 1 6 0 148 87 4 140 107 5 180 109 145 187 129 146 187 Columns 17 through 32 109 5 60 123 186 169 128 46 182 29 21 41 42 122 6 20 Column 33 1 a = Columns 1 through 16 2 0 141 107 125 166 188 9 180 89 44 102 105 25 101 105 Columns 17 through 32 165 8 40 82 64 83 44 82 84 104 25 101 125 86 44 162 Columns 33 through 35 8 20 1 a = Columns 1 through 16 6 0 103 65 23 61 103 5 140 187 89 104 45 162 128 66 Columns 17 through 32 23 121 46 162 188 49 162 68 23 81 144 127 86 84 44 2 Columns 33 through 37 60 3 0 20 1 a = Columns 1 through 16 14 0 7 180 169 8 20 101 5 180 149 7 0 40 102 85 Columns 17 through 32 184 109 145 87 24 81 104 185 29 41 122 146 127 86 164 88 Columns 33 through 39 164 8 60 43 2 20 1 a = Columns 1 through 16 1 4 0 7 180 169 8 20 101 5 180 149 7 0 40 102 Columns 17 through 32 85 184 109 145 87 24 81 104 185 29 41 122 146 127 86 164 Columns 33 through 40 88 164 8 60 43 2 20 1 a = Columns 1 through 16 2 0 81 44 122 146 7 20 1 60 83 84 184 149 107 25 Columns 17 through 32 41 82 124 86 84 4 60 63 43 162 88 84 144 187 149 67 Columns 33 through 42 83 84 104 85 84 64 83 4 20 1 a = Columns 1 through 16 4 0 162 128 146 127 126 186 9 140 187 69 83 4 0 0 Columns 17 through 32 0 0 100 65 83 104 5 120 186 9 20 161 8 80 44 122 Columns 33 through 44 126 46 102 65 83 24 41 62 123 6 20 1 a = Columns 1 through 16 10 0 145 127 86 4 20 81 164 88 184 89 144 67 83 4 Columns 17 through 32 0 20 1 140 87 64 103 165 168 148 47 122 46 122 106 145 Columns 33 through 46 107 25 121 186 69 103 165 168 88 64 163 8 20 1 a = Columns 1 through 16 1 0 0 145 127 86 4 20 81 164 88 184 89 144 67 83 Columns 17 through 32 4 0 20 1 140 87 64 103 165 168 148 47 122 46 122 106 Columns 33 through 47 145 107 25 121 186 69 103 165 168 88 64 163 8 20 1 a = Columns 1 through 16 2 0 21 101 165 108 125 126 186 169 88 144 87 84 24 101 Columns 17 through 32 65 83 44 22 101 185 89 124 26 61 63 63 183 149 187 89 Columns 33 through 48 24 121 6 180 9 80 24 21 41 142 127 6 80 4 0 20 Column 49 1 a = Columns 1 through 16 4 0 62 43 162 148 27 181 129 66 183 69 63 103 145 87 Columns 17 through 32 164 68 143 147 87 4 100 25 141 47 162 28 41 182 169 128 Columns 33 through 48 46 122 66 83 24 141 47 122 126 126 86 164 88 4 80 44 Columns 49 through 51 2 20 1 a = Columns 1 through 16 8 0 124 166 8 140 47 122 86 144 107 5 120 86 164 108 Columns 17 through 32 85 44 62 163 108 165 88 64 183 149 67 103 85 24 1 40 Columns 33 through 48 62 163 188 89 124 166 148 7 100 185 129 66 43 182 49 82 Columns 49 through 53 84 84 4 20 1 a = Columns 1 through 16 18 0 89 4 160 48 122 6 40 22 81 164 168 8 60 103 Columns 17 through 32 145 7 20 181 109 105 85 124 66 163 128 166 28 141 87 104 Columns 33 through 48 165 8 40 162 68 43 2 180 169 188 169 128 46 22 141 167 Columns 49 through 55 28 41 82 124 6 20 1 a = Columns 1 through 16 1 8 0 89 4 160 48 122 6 40 22 81 164 168 8 60 Columns 17 through 32 103 145 7 20 181 109 105 85 124 66 163 128 166 28 141 87 Columns 33 through 48 104 165 8 40 162 68 43 2 180 169 188 169 128 46 22 141 Columns 49 through 56 167 28 41 82 124 6 20 1 a = Columns 1 through 16 2 0 161 188 29 1 120 6 60 3 60 23 181 9 180 109 Columns 17 through 32 25 141 127 6 180 69 3 80 164 48 62 143 107 5 60 3 Columns 33 through 48 180 9 120 66 123 186 49 102 25 161 188 129 46 42 182 149 Columns 49 through 58 167 8 60 3 80 84 164 8 20 1 a = Columns 1 through 16 6 0 163 8 20 1 60 23 41 2 180 89 24 61 163 28 Columns 17 through 32 61 3 60 183 89 144 7 40 122 186 109 145 67 163 28 41 Columns 33 through 48 22 41 22 161 8 40 22 181 129 66 23 21 81 44 22 161 Columns 49 through 60 108 165 88 24 41 2 0 100 5 0 20 1 a = Columns 1 through 16 14 0 127 86 4 0 140 47 142 67 3 180 49 22 141 127 Columns 17 through 32 86 44 2 180 69 63 103 45 82 24 161 88 64 63 123 46 Columns 33 through 48 62 123 86 164 48 42 82 24 81 104 165 108 185 109 145 187 Columns 49 through 62 69 103 85 4 160 28 61 3 0 100 45 2 20 1 a = Columns 1 through 16 1 4 0 127 86 4 0 140 47 142 67 3 180 49 22 141 Columns 17 through 32 127 86 44 2 180 69 63 103 45 82 24 161 88 64 63 123 Columns 33 through 48 46 62 123 86 164 48 42 82 24 81 104 165 108 185 109 145 Columns 49 through 63 187 69 103 85 4 160 28 61 3 0 100 45 2 20 1 a = Columns 1 through 16 2 0 101 65 103 125 106 85 124 26 161 188 29 101 45 142 Columns 17 through 32 87 124 6 120 6 140 127 66 163 68 123 26 1 100 25 101 Columns 33 through 48 165 68 103 65 43 182 69 3 100 65 63 23 141 147 147 107 Columns 49 through 64 85 104 5 20 141 7 60 83 24 81 4 80 104 85 4 20 Column 65 1 a = Columns 1 through 16 6 0 3 160 128 126 126 106 145 167 88 4 20 181 149 7 Columns 17 through 32 20 181 109 165 48 22 61 103 65 23 1 100 145 27 61 123 Columns 33 through 48 166 48 182 9 20 21 181 9 60 143 27 121 166 148 47 162 Columns 49 through ...

6   Pass
%% n=1; x=1; q=1; y_correct = 1; assert(isequal(whatdigit(n,x,q),y_correct))

a = 1