Skip to main content
added 135 characters in body
Source Link
coltim
  • 6.2k
  • 8
  • 13

K (oK), 1515 14 bytes

{(x,x)#1,2_x#02_&x} 

Try it online!Try it online!

Adapted from @Zacharý's APL answer.

  • 2_&x generate x-2 copies of zero
  • 1, prepend a one
  • (x,x) duplicate x
  • (...)#... reshape into a x-by-x matrix

K (oK), 15 bytes

{(x,x)#1,2_x#0} 

Try it online!

Adapted from @Zacharý's APL answer.

K (oK), 15 14 bytes

{(x,x)#1,2_&x} 

Try it online!

Adapted from @Zacharý's APL answer.

  • 2_&x generate x-2 copies of zero
  • 1, prepend a one
  • (x,x) duplicate x
  • (...)#... reshape into a x-by-x matrix
Source Link
coltim
  • 6.2k
  • 8
  • 13

K (oK), 15 bytes

{(x,x)#1,2_x#0} 

Try it online!

Adapted from @Zacharý's APL answer.