Generate the group table for Z_n
APL (10)

(Assuming ⎕IO=0. It works on ngn/apl by default, other APLs tend to need an ⎕IO←0 first.)

{⍵|∘.+⍨⍳⍵}


Explanation:


⍳⍵: the numbers [0..⍵)
∘.+⍨: create a sum table
⍵|: numbers in the table mod ⍵