Mathematica Code

<< NumberTheory`Master`
powertable[p_]:=Map[PowerMod[First[#],Last[#],p]&,Outer[List,Range[0,p-1],Range[1,p]],{2}]//
Prepend[#,Map[(a^#)&,Range[1,p]]]&//
TableForm[#,TableSpacing->Map[1&,Range[p]]]&
powertable [ 7 ]
a a 2 a 3 a 4 a 5 a 6 a 7
0 0 0 0 0 0 0
1 1 1 1 1 1 1
2 4 1 2 4 1 2
3 2 6 4 5 1 3
4 2 1 4 2 1 4
5 4 6 2 3 1 5
6 1 6 1 6 1 6


Converted by Mathematica      April 24, 2000