Skip to main content
1 of 3
Sherlock9
  • 12.4k
  • 1
  • 32
  • 68

Actually, 12 bytes

Based on Emigna's 05AB1E answer.

;;D@²r♀%♂Y╪i 

Ungolfing

 Implicit input: n ;; Duplicate n twice. D Decrement one duplicate @ Switch n-1 with an n ²r Get [0 .. n**2-1] ♀% Get each item of the range modulo n-1 ♂Y Check for equality to 0 ╪ Split into chunks of length n i Flatten this list onto the stack Implicit print 

Try it online!

Sherlock9
  • 12.4k
  • 1
  • 32
  • 68