Problem 57834. Sequence Vectorization - I
Given a Natural number N, return the sequence - [1 1 2 1 2 3 1 2 3 4 ... 1 2 3 ... N-3 N-2 N-1 N] i.e. the horizontal concatenation of (1:k) for k=1:N
%Example 1
N=3;
Out=[1, 1 2, 1 2 3];
%Example 2
N=7;
Out=[1, 1 2, 1 2 3, 1 2 3 4, 1 2 3 4 5, 1 2 3 4 5 6, 1 2 3 4 5 6 7];
As the question deals with vectors, the solutions must be vectorized as well. Check the test suite for banned functions.
There will be a second part to this question.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
Which values occur exactly three times?
5148 Solvers
-
Count from 0 to N^M in base N.
236 Solvers
-
Create an index-powered vector
819 Solvers
-
Back to basics - mean of corner elements of a matrix
433 Solvers
-
Numbers spiral diagonals (Part 1)
210 Solvers
More from this Author31
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!