Cos(2π/257) a la Gauss

by 
Michael Trott
Wolfram Research, Inc.
Champaign, IL 61820
mtrott@wri.com

Mathematica in Education and Research
Volume 4 Number 2
Copyright 1995 TELOS/Springer-Verlag

Code to produce animation

Function[p, Sort[Array[PowerMod[3, #, p]&, p - 1, 0]] == 
           Range[p - 1]] /@ {5, 17, 257, 65537}

Function[b, 
   Show[Graphics[Line[Append[#, First[#]]&[
(* connect numbers in their permuted order *)
{Cos[#], Sin[#]}& /@ N[2Pi Array[
     PowerMod[b, #, 257]&, 256, 0]/257]]]], 
    PlotRange -> All,
    AspectRatio -> Automatic]] /@ 
    (* reduced residue system exists for the
       following 128 numbers; can be done 
       "by hand " *)
     Flatten[Position[Table[Sort[Array[
       PowerMod[i, #, 257]&, 256, 0]] ==  
          Range[256], {i, 256}], True]];