# [R], [Jarko, again](https://codegolf.stackexchange.com/a/136413/67312)

<!-- language-all: lang-r -->

    cat(diag(diag(('i'%in%'i'):(x=scan()),x%x%x)),sep='')

This differs from Jarko Dubbeldam's intended solution, but the general idea is the same: to generate `1:n` repeated `1:n` times, it leverages `diag` in two different ways:

 - `diag(matrix)` returns the diagonal of a matrix.
 - `diag(vector, nrow)` generates an `nrow`x`nrow` matrix with `vector` along the diagonal, recycling as necessary.

`%x%` is the Kronecker matrix product which when applied to two numbers returns their usual product.

Finally, `cat` prints the diagonal out with `sep`arator `''` which results in the sequence.

[Try it online!][TIO-j5o49hk7]

[R]: https://www.r-project.org/
[TIO-j5o49hk7]: https://tio.run/##K/r/PzmxRCMlMzEdQmioZ6qrZuapAilNK40K2@LkxDwNTU2dClUgBNLFqQW26uqa/83@AwA "R – Try It Online"