Hot answers tagged

3

jq, 20 bytes range(.*.)*(1+1/.)%. Try it online! output is flattened (my first jq answer)


2

TI-Basic, 28 bytes Prompt N For(I,1,N Disp remainder(I+seq(J,J,1,N),N End Outputs each row as a list on a separate line. Note that remainder( only works for TI-84+/SE with the 2.53 MP OS. The below version uses 2 more bytes but is compatible with earlier OS's. 30 bytes Prompt N For(I,1,N Disp NfPart((I+seq(J,J,1,N))/N End


1

APL (Dyalog Extended), 11 bytes {⍵ ⍵⍴1,⍵/0} Try it online! Just for fun dfn submission ⍵/0 replicate ⍵ zeros 1, prepend a 1 ⍵ ⍵⍴ mold to ⍵×⍵ square So like for left argument 4 it will construct 1 0 0 0 0 And molding cycles from the beginning so, it will generate 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 the 4×4 identity matrix.


Only top voted, non community-wiki answers of a minimum length are eligible