Cody

# Problem 1548. Vector of numbers divisible by 3

Solution 3442003

Submitted on 27 Oct 2020 by Wesley Maa
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 0 v = 3 v = 3

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

v = 6 3 0 v = 6 3 v = 6 3

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

v = 15 12 9 6 3 0 v = 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))

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 67 24 21 18 15 12 9 6 3 0 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 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))

v = 48 45 42 39 36 33 30 27 24 21 18 15 12 9 6 3 0 v = 48 45 42 39 36 33 30 27 24 21 18 15 12 9 6 3 v = 48 45 42 39 36 33 30 27 24 21 18 15 12 9 6 3

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!