Cody

# Problem 1035. Generate a vector like 1,2,2,3,3,3,4,4,4,4

Solution 1888967

Submitted on 31 Jul 2019 by Jacques Tott-buswell
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 = 2; y_correct = [1 2 2]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2

2   Pass
x = 5; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2 m = 2 el_m = 0 1 2 entry_end = 6 entry_start = 4 ans = 1 2 2 3 3 3 m = 3 el_m = 0 1 2 3 entry_end = 10 entry_start = 7 ans = 1 2 2 3 3 3 4 4 4 4 m = 4 el_m = 0 1 2 3 4 entry_end = 15 entry_start = 11 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

3   Pass
x = 10; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ... 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2 m = 2 el_m = 0 1 2 entry_end = 6 entry_start = 4 ans = 1 2 2 3 3 3 m = 3 el_m = 0 1 2 3 entry_end = 10 entry_start = 7 ans = 1 2 2 3 3 3 4 4 4 4 m = 4 el_m = 0 1 2 3 4 entry_end = 15 entry_start = 11 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 m = 5 el_m = 0 1 2 3 4 5 entry_end = 21 entry_start = 16 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 m = 6 el_m = 0 1 2 3 4 5 6 entry_end = 28 entry_start = 22 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 m = 7 el_m = 0 1 2 3 4 5 6 7 entry_end = 36 entry_start = 29 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 36 8 8 8 8 8 8 m = 8 el_m = 0 1 2 3 4 5 6 7 8 entry_end = 45 entry_start = 37 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 m = 9 el_m = 0 1 2 3 4 5 6 7 8 9 entry_end = 55 entry_start = 46 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 55 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10

4   Pass
x = 12; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ... 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 ... 11 11 11 11 11 11 11 11 11 11 11 ... 12 12 12 12 12 12 12 12 12 12 12 12]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2 m = 2 el_m = 0 1 2 entry_end = 6 entry_start = 4 ans = 1 2 2 3 3 3 m = 3 el_m = 0 1 2 3 entry_end = 10 entry_start = 7 ans = 1 2 2 3 3 3 4 4 4 4 m = 4 el_m = 0 1 2 3 4 entry_end = 15 entry_start = 11 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 m = 5 el_m = 0 1 2 3 4 5 entry_end = 21 entry_start = 16 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 m = 6 el_m = 0 1 2 3 4 5 6 entry_end = 28 entry_start = 22 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 m = 7 el_m = 0 1 2 3 4 5 6 7 entry_end = 36 entry_start = 29 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 36 8 8 8 8 8 8 m = 8 el_m = 0 1 2 3 4 5 6 7 8 entry_end = 45 entry_start = 37 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 m = 9 el_m = 0 1 2 3 4 5 6 7 8 9 entry_end = 55 entry_start = 46 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 55 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 m = 10 el_m = 0 1 2 3 4 5 6 7 8 9 10 entry_end = 66 entry_start = 56 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 66 11 11 11 11 11 11 m = 11 el_m = 0 1 2 3 4 5 6 7 8 9 10 11 entry_end = 78 entry_start = 67 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 78 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12

5   Pass
x = 9; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ... 9 9 9 9 9 9 9 9 9]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2 m = 2 el_m = 0 1 2 entry_end = 6 entry_start = 4 ans = 1 2 2 3 3 3 m = 3 el_m = 0 1 2 3 entry_end = 10 entry_start = 7 ans = 1 2 2 3 3 3 4 4 4 4 m = 4 el_m = 0 1 2 3 4 entry_end = 15 entry_start = 11 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 m = 5 el_m = 0 1 2 3 4 5 entry_end = 21 entry_start = 16 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 m = 6 el_m = 0 1 2 3 4 5 6 entry_end = 28 entry_start = 22 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 m = 7 el_m = 0 1 2 3 4 5 6 7 entry_end = 36 entry_start = 29 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 36 8 8 8 8 8 8 m = 8 el_m = 0 1 2 3 4 5 6 7 8 entry_end = 45 entry_start = 37 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9

6   Pass
x = 7; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... 6 6 6 6 6 6 7 7 7 7 7 7 7]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2 m = 2 el_m = 0 1 2 entry_end = 6 entry_start = 4 ans = 1 2 2 3 3 3 m = 3 el_m = 0 1 2 3 entry_end = 10 entry_start = 7 ans = 1 2 2 3 3 3 4 4 4 4 m = 4 el_m = 0 1 2 3 4 entry_end = 15 entry_start = 11 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 m = 5 el_m = 0 1 2 3 4 5 entry_end = 21 entry_start = 16 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 m = 6 el_m = 0 1 2 3 4 5 6 entry_end = 28 entry_start = 22 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7

7   Pass
x = 15; y_correct = [1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 ... 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 ... 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 ... 11 11 11 11 11 11 11 11 11 11 11 ... 12 12 12 12 12 12 12 12 12 12 12 12 ... 13 13 13 13 13 13 13 13 13 13 13 13 13 ... 14 14 14 14 14 14 14 14 14 14 14 14 14 14 ... 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15]; assert(isequal(your_fcn_name(x),y_correct))

m = 0 el_m = 0 entry_end = 1 entry_start = 1 ans = 1 m = 1 el_m = 0 1 entry_end = 3 entry_start = 2 ans = 1 2 2 m = 2 el_m = 0 1 2 entry_end = 6 entry_start = 4 ans = 1 2 2 3 3 3 m = 3 el_m = 0 1 2 3 entry_end = 10 entry_start = 7 ans = 1 2 2 3 3 3 4 4 4 4 m = 4 el_m = 0 1 2 3 4 entry_end = 15 entry_start = 11 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 m = 5 el_m = 0 1 2 3 4 5 entry_end = 21 entry_start = 16 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 m = 6 el_m = 0 1 2 3 4 5 6 entry_end = 28 entry_start = 22 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 m = 7 el_m = 0 1 2 3 4 5 6 7 entry_end = 36 entry_start = 29 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 36 8 8 8 8 8 8 m = 8 el_m = 0 1 2 3 4 5 6 7 8 entry_end = 45 entry_start = 37 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 45 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 m = 9 el_m = 0 1 2 3 4 5 6 7 8 9 entry_end = 55 entry_start = 46 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 55 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 m = 10 el_m = 0 1 2 3 4 5 6 7 8 9 10 entry_end = 66 entry_start = 56 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 66 11 11 11 11 11 11 m = 11 el_m = 0 1 2 3 4 5 6 7 8 9 10 11 entry_end = 78 entry_start = 67 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 78 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 m = 12 el_m = 0 1 2 3 4 5 6 7 8 9 10 11 12 entry_end = 91 entry_start = 79 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 90 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 Column 91 13 m = 13 el_m = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 entry_end = 105 entry_start = 92 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 90 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 Columns 91 through 105 13 14 14 14 14 14 14 14 14 14 14 14 14 14 14 m = 14 el_m = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 entry_end = 120 entry_start = 106 ans = Columns 1 through 30 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 Columns 31 through 60 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 Columns 61 through 90 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 Columns 91 through 120 13 14 14 14 14 14 14 14 14 14 14 14 14 14 14 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15