> < ^ From:

> ^ Subject:

Dear GAP-forum,

we just needed a function to test whether a given cyclotomic

field element is a root of unity. Since GAP v3.4 does not

contain such a function our first guess was

IsRootOfUnityCyc := function ( x ) return IsCyc(x) and x^NofCyc(x) = 1; # Do not use this! end;

Trying it on Random(CF(43)) convinced us that there must be

a better way. This is our solution:

IsRootOfUnityCyc := function ( x ) return IsCyc(x) and x*GaloisCyc(x, -1) = 1; # Use this. end;

It is obvious why the second function outperforms the first

one by orders of magnitude. However, you need to think of it.

Does anybody know a faster solution?

Sebastian Egner, Markus P"uschel.

> < [top]