Manipulate[ Text[Grid[Table[Mod[i^j, k], {i, n}, {j, n}], Background -> LightYellow, Frame -> All]], {n, 3, 10}, {k, 2, 10000, 10}]