Cody

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

Solution 3024829

Submitted on 1 Oct 2020 at 23:16 by Henry Rong
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))

C = 1 3 ans = 1 2 3 A = 1 2 ans = 1 2 3 ans = 1 2 3 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))

C = 1 3 6 10 15 ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A = 1 2 4 7 11 ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ans = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ans = 1 2 2 4 5 6 7 8 9 10 11 12 13 14 15 ans = 1 2 2 3 5 6 7 8 9 10 11 12 13 14 15 ans = 1 2 2 3 3 6 7 8 9 10 11 12 13 14 15 ans = 1 2 2 3 3 3 7 8 9 10 11 12 13 14 15 ans = 1 2 2 3 3 3 4 8 9 10 11 12 13 14 15 ans = 1 2 2 3 3 3 4 4 9 10 11 12 13 14 15 ans = 1 2 2 3 3 3 4 4 4 10 11 12 13 14 15 ans = 1 2 2 3 3 3 4 4 4 4 11 12 13 14 15 ans = 1 2 2 3 3 3 4 4 4 4 5 12 13 14 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 13 14 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 14 15 ans = 1 2 2 3 3 3 4 4 4 4 5 5 5 5 15 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))

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

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

C = 1 3 6 10 15 21 28 36 45 55 66 78 ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 A = 1 2 4 7 11 16 22 29 37 46 56 67 ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 5 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 5 5 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 5 5 5 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 78 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55...

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

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

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

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

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

C = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 A = 1 2 4 7 11 16 22 29 37 46 56 67 79 92 106 ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 3 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 3 4 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 Columns 59 through 87 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Columns 88 through 116 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 Columns 117 through 120 117 118 119 120 ans = Columns 1 through 29 1 2 2 3 3 3 4 4 4 4 5 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Columns 30 through 58 30 31 32 33 34 35 36 37 38 ...

### Community Treasure Hunt

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

Start Hunting!