'%(),:=acdeginpstx
Let's try this without the l
or o
.
Since this has been cracked, the intended solution:
cat(diag(diag((a=scan()))%x%diag((a==a):a)),sep='')
. diag
is an interesting function, that can be used in three different ways. When presented with a single integer (diag(n)
), it creates a NxN matrix with 1 on the diagonal. When presented with a vector (diag(1:n)
), it creates an NxN matrix with the vector on the diagonal. When presented with a matrix (diag(diag(n))
), it returns the diagonal as a vector. %x%
computed the Kronecker product of two matrices, where each element in matrix 1 is multiplied with each element in matrix 2 separately. Doing this with a length n
identity matrix and a 1:n
diagonal matrix, creates a length n^2
diagonal matrix with 1:n
repeated n
times. diag
extracts that again, and cat
prints.