Function: nfrootsof1
Section: number_fields
C-Name: nfrootsof1
Prototype: G
Help: nfrootsof1(nf): number of roots of unity and primitive root of unity
 in the number field nf.
Doc: Returns a two-component vector $[w,z]$ where $w$ is the number of roots of
 unity in the number field \var{nf}, and $z$ is a primitive $w$-th root
 of unity. It is possible to input a defining polynomial for \var{nf}
 instead.
 \bprog
 ? K = nfinit(polcyclo(11));
 ? nfrootsof1(K)
 %2 = [22, [0, 0, 0, 0, 0, -1, 0, 0, 0, 0]~]
 ? z = nfbasistoalg(K, %[2])   \\ in algebraic form
 %3 = Mod(-x^5, x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1)
 ? [lift(z^11), lift(z^2)]     \\ proves that the order of z is 22
 %4 = [-1, -x^9 - x^8 - x^7 - x^6 - x^5 - x^4 - x^3 - x^2 - x - 1]
 @eprog
 This function guesses the number $w$ as the gcd of the $\#k(v)^{*}$ for
 unramified $v$ above odd primes, then computes the roots in \var{nf}
 of the $w$-th cyclotomic polynomial. The algorithm is polynomial time with
 respect to the field degree and the bitsize of the multiplication table in
 \var{nf} (both of them polynomially bounded in terms of the size of the
 discriminant). Fields of degree up to $100$ or so should require less than
 one minute.
