Cody

# Problem 1548. Vector of numbers divisible by 3

Solution 1575415

Submitted on 4 Jul 2018 by Srishti Saha
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))

a1 = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 116 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 Columns 117 through 145 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 Columns 146 through 174 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 Columns 175 through 201 222 225 228 231 234 237 240 243 246 249 252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 300 a = Columns 1 through 29 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 Columns 30 through 58 90 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 Columns 59 through 87 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 222 225 228 231 234 237 240 243 246 249 252 255 258 261 Columns 88 through 100 264 267 270 273 276 279 282 285 288 291 294 297 300 af = 3 v = 3

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

a1 = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 116 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 Columns 117 through 145 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 Columns 146 through 174 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 Columns 175 through 201 222 225 228 231 234 237 240 243 246 249 252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 300 a = Columns 1 through 29 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 Columns 30 through 58 90 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 Columns 59 through 87 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 222 225 228 231 234 237 240 243 246 249 252 255 258 261 Columns 88 through 100 264 267 270 273 276 279 282 285 288 291 294 297 300 af = 3 6 v = 6 3

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

a1 = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 116 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 Columns 117 through 145 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 Columns 146 through 174 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 Columns 175 through 201 222 225 228 231 234 237 240 243 246 249 252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 300 a = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 100 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 af = -15 -12 -9 -6 -3 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))

a1 = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 116 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 Columns 117 through 145 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 Columns 146 through 174 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 Columns 175 through 201 222 225 228 231 234 237 240 243 246 249 252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 300 a = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 100 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 af = Columns 1 through 29 -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 Columns 30 through 58 -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 Columns 59 through 66 -24 -21 -18 -15 -12 -9 -6 -3 v = Columns 1 through 29 -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 Columns 30 through 58 -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 Columns 59 through 66 -24 -21 -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))

a1 = Columns 1 through 29 -300 -297 -294 -291 -288 -285 -282 -279 -276 -273 -270 -267 -264 -261 -258 -255 -252 -249 -246 -243 -240 -237 -234 -231 -228 -225 -222 -219 -216 Columns 30 through 58 -213 -210 -207 -204 -201 -198 -195 -192 -189 -186 -183 -180 -177 -174 -171 -168 -165 -162 -159 -156 -153 -150 -147 -144 -141 -138 -135 -132 -129 Columns 59 through 87 -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 Columns 88 through 116 -39 -36 -33 -30 -27 -24 -21 -18 -15 -12 -9 -6 -3 0 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 Columns 117 through 145 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 Columns 146 through 174 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 Columns 175 through 201 222 225 228 231 234 237 240 243 246 249 252 255 258 261 264 267 270 273 276 279 282 285 288 291 294 297 300 a = Columns 1 through 29 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 Columns 30 through 58 90 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 Columns 59 through 87 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 222 225 228 231 234 237 240 243 246 249 252 255 258 261 Columns 88 through 100 264 267 270 273 276 279 282 285 288 291 294 297 300 af = 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