Count Up, Replace, Repeat!
Jelly, 3 bytes
R¡F
Try it online
Explanation
R¡F Argument n
R Yield range [1..n]
¡ Repeat n times
F Flatten the result
Python, 50 bytes
lambda i:eval("[i "+"for i in range(1,i+1)"*i+"]")
Scope abuse! For example, for i=3
, the string to be evaluated expands to.
[i for i in range(1,i+1)for i in range(1,i+1)for i in range(1,i+1)]
Somehow, despite using the function input variable i
for everything, Python distinguishes each iteration index as belonging to a separate scope as if the expression were
[l for j in range(1,i+1)for k in range(1,j+1)for l in range(1,k+1)]
with i
the input to the function.
05AB1E, 6 3 bytes
DFL
Explained
D # duplicate input
F # input times do
L # range(1,N)
Try it online
Saved 3 bytes thanks to @Adnan