up previous next
CyclotomicIndex    --    computes the index of a given cyclotomic polynomial


Syntax
CyclotomicIndex(F: RINGELEM): INT

Description
This function takes the given polynomial F and returns the index n if it is the n-th cyclotomic polynomial. Otherwise, it returns 0. To test whether a polynomial is cyclotomic, call CyclotomicIndex and check that the result is non-zero.

There is also CyclotomicIndex_unchecked. It is correct if the given polynomial is cyclotomic, but may (rarely) return a non-zero value if the input polynomial is not cyclotomic. It is faster than the main function.

Example
/**/  use R ::= QQ[x];
/**/  CyclotomicIndex(x^6 +x^3 +1);
9
/**/  CyclotomicIndex(x^4 -x^2 +2);
0

See Also