Is n below a primitive root of unity? n=._1^3r8
*./2 x:(12 o. n)%o.2 48 n^48 1j_3.9968e_15 Yes. On Mon, Jun 2, 2014 at 1:42 PM, Don Guinn <[email protected]> wrote: > I don't think that this is a complete test. If 1~:|n then it it is not a > primitive root of unity. But n must be a complex number when raised to an > *integer* power is 1. Maybe converting the complex number to polar then > checking the angle and seeing if it is a rational fraction of a circle. > > Obviously computers will always find some rational number though it might > require raising n to a very large power. There should be some reasonable > limit as to how large the power may be. > > > On Mon, Jun 2, 2014 at 1:08 PM, Raul Miller <[email protected]> wrote: > >> 1=|n >> >> Thanks, >> >> -- >> Raul >> >> >> On Mon, Jun 2, 2014 at 2:54 PM, Dan Bron <[email protected]> wrote: >> > Given a complex number, how can I determine whether it is a primitive >> root >> > of unity? >> > >> > (This is a subtask of a code golf problem, so the shorter the better) >> > >> > -Dan >> > ---------------------------------------------------------------------- >> > For information about J forums see http://www.jsoftware.com/forums.htm >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
