Cody

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

Solution 3418293

Submitted on 27 Oct 2020 by Elena Mendez-Romero
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))

p = 1 x = 1 q = 3 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3

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))

p = 1 x = 1 q = 15 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3 ans = 1 2 2 3 p = 5 ans = 1 2 2 3 3 p = 6 ans = 1 2 2 3 3 3 p = 7 x = 4 ans = 1 2 2 3 3 3 4 p = 8 ans = 1 2 2 3 3 3 4 4 p = 9 ans = 1 2 2 3 3 3 4 4 4 p = 10 ans = 1 2 2 3 3 3 4 4 4 4 p = 11 x = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 p = 12 ans = 1 2 2 3 3 3 4 4 4 4 5 5 p = 13 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 p = 14 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 p = 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 p = 16 x = 6

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))

p = 1 x = 1 q = 55 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3 ans = 1 2 2 3 p = 5 ans = 1 2 2 3 3 p = 6 ans = 1 2 2 3 3 3 p = 7 x = 4 ans = 1 2 2 3 3 3 4 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7 7 7 8 p = 30 ans = Columns 1 through 29 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 Column 30 8 p = 31 ans = Columns 1 through 29 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 Columns 30 through 31 8 8 p = 32 ans = Columns 1 through 29 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 Columns 30 through 32 8 8 8 p = 33 ans = Columns 1 through 29 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 Columns 30 through 33 8 8 8 8 p = 34 ans = Columns 1 through 29 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 Columns 30 through 34 8 8 8 8 8 p = 35 ans = Columns 1 through 29 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 Columns 30 through 35 8 8 8 8 8 8 p = 36 ans = Columns 1 through 29 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 Columns 30 through 36 8 8 8 8 8 8 8 p = 37 x = 9 ans = Columns 1 through 29 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 Columns 30 through 37 8 8 8 8 8 8 8 9 p = 38 ans = Columns 1 through 29 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 Columns 30 through 38 8 8 8 8 8 8 8 9 9 p = 39 ans = Columns 1 through 29 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 Columns 30 through 39 8 8 8 8 8 8 8 9 9 9 p = 40 ans = Columns 1 through 29 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 Columns 30 through 40 8 8 8 8 8 8 8 9 9 9 9 p = 41 ans = Columns 1 through 29 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 Columns 30 through 41 8 8 8 8 8 8 8 9 9 9 9 9 p = 42 ans = Columns 1 through 29 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 Columns 30 through 42 8 8 8 8 8 8 8 9 9 9 9 9 9 p = 43 ans = Columns 1 through 29 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 Columns 30 through 43 8 8 8 8 8 8 8 9 9 9 9 9 9 9 p = 44 ans = Columns 1 through 29 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 Columns 30 through 44 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 p = 45 ans = Columns 1 through 29 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 Columns 30 through 45 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 p = 46 x = 10 ans = Columns 1 through 29 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 Columns 30 through 46 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 p = 47 ans = Columns 1 through 29 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 Columns 30 through 47 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 p = 48 ans = Columns 1 through 29 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 Columns 30 through 48 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 p = 49 ans = Columns 1 through 29 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 Columns 30 through 49 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 p = 50 ans = Columns 1 through 29 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 Columns 30 through 50 8 8 8 8 8 8 8 9 9 9 9...

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))

p = 1 x = 1 q = 78 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3 ans = 1 2 2 3 p = 5 ans = 1 2 2 3 3 p = 6 ans = 1 2 2 3 3 3 p = 7 x = 4 ans = 1 2 2 3 3 3 4 p = 8 ans = 1 2 2 3 3 3 4 4 p = 9 ans = 1 2 2 3 3 3 4 4 4 p = 10 ans = 1 2 2 3 3 3 4 4 4 4 p = 11 x = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 p = 12 ans = 1 2 2 3 3 3 4 4 4 4 5 5 p = 13 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 p = 14 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 p = 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 p = 16 x = 6 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 p = 17 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 p = 18 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 p = 19 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 p = 20 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 p = 21 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 p = 22 x = 7 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 p = 23 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 p = 24 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 p = 25 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 p = 26 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 p = 27 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 p = 28 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 p = 29 x = 8 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 8 p = 30 ans = Columns 1 through 29 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 Column 30 8 p = 31 ans = Columns 1 through 29 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 Columns 30 through 31 8 8 p = 32 ans = Columns 1 through 29 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 Columns 30 through 32 8 8 8 p = 33 ans = Columns 1 through 29 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 Columns 30 through 33 8 8 8 8 p = 34 ans = Columns 1 through 29 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 Columns 30 through 34 8 8 8 8 8 p = 35 ans = Columns 1 through 29 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 Columns 30 through 35 8 8 8 8 8 8 p = 36 ans = Columns 1 through 29 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 Columns 30 through 36 8 8 8 8 8 8 8 p = 37 x = 9 ans = Columns 1 through 29 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 Columns 30 through 37 8 8 8 8 8 8 8 9 p = 38 ans = Columns 1 through 29 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 Columns 30 through 38 8 8 8 8 8 8 8 9 9 p = 39 ans = Columns 1 through 29 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 Columns 30 through 39 8 8 8 8 8 8 8 9 9 9 p = 40 ans = Columns 1 through 29 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 Columns 30 through 40 8 8 8 8 8 8 8 9 9 9 9 p = 41 ans = Columns 1 through 29 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 Columns 30 through 41 8 8 8 8 8 8 8 9 9 9 9 9 p = 42 ans = Columns 1 through 29 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 Columns 30 through 42 8 8 8 8 8 8 8 9 9 9 9 9 9 p = 43 ans = Columns 1 through 29 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 Columns 30 through 43 8 8 8 8 8 8 8 9 9 9 9 9 9 9 p = 44 ans = Columns 1 through 29 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 Columns 30 through 44 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 p = 45 ans = Columns 1 through 29 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 Columns 30 through 45 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 p = 46 x = 10 ans = Columns 1 through 29 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 Columns 30 through 46 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 p = 47 ans = Columns 1 through 29 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 Columns 30 through 47 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 p = 48 ans = Columns 1 through 29 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 Columns 30 through 48 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 p = 49 ans = Columns 1 through 29 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 Columns 30 through 49 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 p = 50 ans = Columns 1 through 29 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 Columns 30 through 50 8 8 8 8 8 8 8 9 9 9 9...

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))

p = 1 x = 1 q = 45 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3 ans = 1 2 2 3 p = 5 ans = 1 2 2 3 3 p = 6 ans = 1 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4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 p = 30 ans = Columns 1 through 29 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 Column 30 8 p = 31 ans = Columns 1 through 29 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 Columns 30 through 31 8 8 p = 32 ans = Columns 1 through 29 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 Columns 30 through 32 8 8 8 p = 33 ans = Columns 1 through 29 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 Columns 30 through 33 8 8 8 8 p = 34 ans = Columns 1 through 29 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 Columns 30 through 34 8 8 8 8 8 p = 35 ans = Columns 1 through 29 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 Columns 30 through 35 8 8 8 8 8 8 p = 36 ans = Columns 1 through 29 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 Columns 30 through 36 8 8 8 8 8 8 8 p = 37 x = 9 ans = Columns 1 through 29 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 Columns 30 through 37 8 8 8 8 8 8 8 9 p = 38 ans = Columns 1 through 29 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 Columns 30 through 38 8 8 8 8 8 8 8 9 9 p = 39 ans = Columns 1 through 29 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 Columns 30 through 39 8 8 8 8 8 8 8 9 9 9 p = 40 ans = Columns 1 through 29 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 Columns 30 through 40 8 8 8 8 8 8 8 9 9 9 9 p = 41 ans = Columns 1 through 29 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 Columns 30 through 41 8 8 8 8 8 8 8 9 9 9 9 9 p = 42 ans = Columns 1 through 29 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 Columns 30 through 42 8 8 8 8 8 8 8 9 9 9 9 9 9 p = 43 ans = Columns 1 through 29 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 Columns 30 through 43 8 8 8 8 8 8 8 9 9 9 9 9 9 9 p = 44 ans = Columns 1 through 29 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 Columns 30 through 44 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 p = 45 ans = Columns 1 through 29 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 Columns 30 through 45 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 p = 46 x = 10

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))

p = 1 x = 1 q = 28 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3 ans = 1 2 2 3 p = 5 ans = 1 2 2 3 3 p = 6 ans = 1 2 2 3 3 3 p = 7 x = 4 ans = 1 2 2 3 3 3 4 p = 8 ans = 1 2 2 3 3 3 4 4 p = 9 ans = 1 2 2 3 3 3 4 4 4 p = 10 ans = 1 2 2 3 3 3 4 4 4 4 p = 11 x = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 p = 12 ans = 1 2 2 3 3 3 4 4 4 4 5 5 p = 13 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 p = 14 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 p = 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 p = 16 x = 6 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 p = 17 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 p = 18 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 p = 19 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 p = 20 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 p = 21 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 p = 22 x = 7 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 p = 23 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 p = 24 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 p = 25 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 p = 26 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 p = 27 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 p = 28 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 p = 29 x = 8

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))

p = 1 x = 1 q = 120 ans = 1 p = 2 x = 2 ans = 1 2 p = 3 ans = 1 2 2 p = 4 x = 3 ans = 1 2 2 3 p = 5 ans = 1 2 2 3 3 p = 6 ans = 1 2 2 3 3 3 p = 7 x = 4 ans = 1 2 2 3 3 3 4 p = 8 ans = 1 2 2 3 3 3 4 4 p = 9 ans = 1 2 2 3 3 3 4 4 4 p = 10 ans = 1 2 2 3 3 3 4 4 4 4 p = 11 x = 5 ans = 1 2 2 3 3 3 4 4 4 4 5 p = 12 ans = 1 2 2 3 3 3 4 4 4 4 5 5 p = 13 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 p = 14 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 p = 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 p = 16 x = 6 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 p = 17 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 p = 18 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 p = 19 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 p = 20 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 p = 21 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 p = 22 x = 7 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 p = 23 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 p = 24 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 p = 25 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 p = 26 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 p = 27 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 p = 28 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 p = 29 x = 8 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 8 p = 30 ans = Columns 1 through 29 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 Column 30 8 p = 31 ans = Columns 1 through 29 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 Columns 30 through 31 8 8 p = 32 ans = Columns 1 through 29 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 Columns 30 through 32 8 8 8 p = 33 ans = Columns 1 through 29 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 Columns 30 through 33 8 8 8 8 p = 34 ans = Columns 1 through 29 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 Columns 30 through 34 8 8 8 8 8 p = 35 ans = Columns 1 through 29 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 Columns 30 through 35 8 8 8 8 8 8 p = 36 ans = Columns 1 through 29 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 Columns 30 through 36 8 8 8 8 8 8 8 p = 37 x = 9 ans = Columns 1 through 29 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 Columns 30 through 37 8 8 8 8 8 8 8 9 p = 38 ans = Columns 1 through 29 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 Columns 30 through 38 8 8 8 8 8 8 8 9 9 p = 39 ans = Columns 1 through 29 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 Columns 30 through 39 8 8 8 8 8 8 8 9 9 9 p = 40 ans = Columns 1 through 29 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 Columns 30 through 40 8 8 8 8 8 8 8 9 9 9 9 p = 41 ans = Columns 1 through 29 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 Columns 30 through 41 8 8 8 8 8 8 8 9 9 9 9 9 p = 42 ans = Columns 1 through 29 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 Columns 30 through 42 8 8 8 8 8 8 8 9 9 9 9 9 9 p = 43 ans = Columns 1 through 29 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 Columns 30 through 43 8 8 8 8 8 8 8 9 9 9 9 9 9 9 p = 44 ans = Columns 1 through 29 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 Columns 30 through 44 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 p = 45 ans = Columns 1 through 29 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 Columns 30 through 45 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 p = 46 x = 10 ans = Columns 1 through 29 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 Columns 30 through 46 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 p = 47 ans = Columns 1 through 29 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 Columns 30 through 47 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 p = 48 ans = Columns 1 through 29 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 Columns 30 through 48 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 p = 49 ans = Columns 1 through 29 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 Columns 30 through 49 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 10 10 10 10 p = 50 ans = Columns 1 through 29 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 Columns 30 through 50 8 8 8 8 8 8 8 9 9 9 9...

### Community Treasure Hunt

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

Start Hunting!