#Pyth, 16
Pyth, 16
JVQXQjdJ=J+tJ]hJ Prints the table with proper whitespace.
./pyth.py -c "JVQXQjdJ=J+tJ]hJ" <<< 5 0 1 2 3 4 1 2 3 4 0 2 3 4 0 1 3 4 0 1 2 4 0 1 2 3 Explanation:
Automatic: Q=eval(input()) JVQ J = range(Q) XQ repeat Q times jdJ print J, joined on " " =J J = +tJ]hJ tail(J) + [head(J)] (J[1:] + [J[-1]]])