Cody

# Problem 1548. Vector of numbers divisible by 3

Solution 2096333

Submitted on 17 Jan 2020 by Yoshimasa Nakatani
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 = 3; y_correct = 3; assert(isequal(divby3_vector(x),y_correct))

v = 3 2 1 id = 1 v = 3

2   Pass
x = 7; y_correct = [6 3]; assert(isequal(divby3_vector(x),y_correct))

v = 7 6 5 4 3 2 1 id = 2 5 v = 6 3

3   Pass
x = -16; y_correct = [-15 -12 -9 -6 -3]; assert(isequal(divby3_vector(x),y_correct))

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

4   Pass
x = -200; y_correct = [-198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 -126 -123 -120 -117 -114 -111 -108 -105 -102 -99 -96 -93 -90 -87 -84 -81 -78 -75 -72 -69 -66 -63 -60 -57 -54 -51 -48 -45 -42 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3]; assert(isequal(divby3_vector(x),y_correct))

v = Columns 1 through 30 -200 -199 -198 -197 -196 -195 -194 -193 -192 -191 -190 -189 -188 -187 -186 -185 -184 -183 -182 -181 -180 -179 -178 -177 -176 -175 -174 -173 -172 -171 Columns 31 through 60 -170 -169 -168 -167 -166 -165 -164 -163 -162 -161 -160 -159 -158 -157 -156 -155 -154 -153 -152 -151 -150 -149 -148 -147 -146 -145 -144 -143 -142 -141 Columns 61 through 90 -140 -139 -138 -137 -136 -135 -134 -133 -132 -131 -130 -129 -128 -127 -126 -125 -124 -123 -122 -121 -120 -119 -118 -117 -116 -115 -114 -113 -112 -111 Columns 91 through 120 -110 -109 -108 -107 -106 -105 -104 -103 -102 -101 -100 -99 -98 -97 -96 -95 -94 -93 -92 -91 -90 -89 -88 -87 -86 -85 -84 -83 -82 -81 Columns 121 through 150 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 Columns 151 through 180 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 Columns 181 through 200 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 id = Columns 1 through 30 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 Columns 31 through 60 93 96 99 102 105 108 111 114 117 120 123 126 129 132 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 Columns 61 through 66 183 186 189 192 195 198 v = Columns 1 through 30 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 -126 -123 -120 -117 -114 -111 Columns 31 through 60 -108 -105 -102 -99 -96 -93 -90 -87 -84 -81 -78 -75 -72 -69 -66 -63 -60 -57 -54 -51 -48 -45 -42 -39 -36 -33 -30 -27 -24 -21 Columns 61 through 66 -18 -15 -12 -9 -6 -3

5   Pass
x = 50; y_correct = [48 45 42 39 36 33 30 27 24 21 18 15 12 9 6 3]; assert(isequal(divby3_vector(x),y_correct))

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