Function: znconreylog
Section: number_theoretical
C-Name: znconreylog
Prototype: GG
Help: znconreylog(G,m): Conrey logarithm attached to m in (Z/qZ)*,
 where G is znstar(q,1).
Doc: Given a \var{znstar} attached to $(\Z/q\Z)^{*}$ (as per
 \kbd{G = znstar(q,1)}), this function returns the Conrey logarithm of
 $m \in (\Z/q\Z)^{*}$.

 Let $q = \prod_{p} p^{e_{p}}$ be the factorization of $q$ into distinct primes,
 where we assume $e_{2} = 0$ or $e_{2} \geq 2$. (If $e_{2} = 1$, we can ignore
 $2$ from the factorization, as if we replaced $q$ by $q/2$, since
 $(\Z/q\Z)^{*} \sim (\Z/(q/2)\Z)^{*}$.)

 For all odd  $p$ with $e_{p} > 0$, let $g_{p}$ be the element in $(\Z/q\Z)^{*}$
 which is

 \item congruent to $1$ mod $q/p^{e_{p}}$,

 \item congruent mod $p^{e_{p}}$ to the smallest positive integer that generates
 $(\Z/p^{2}\Z)^{*}$.

 For $p = 2$, we let $g_{4}$ (if $2^{e_{2}} \geq 4$) and $g_{8}$ (if furthermore
 ($2^{e_{2}} \geq 8$) be the elements in $(\Z/q\Z)^{*}$ which are

 \item congruent to $1$ mod $q/2^{e_{2}}$,

 \item $g_{4} = -1 \mod 2^{e_{2}}$,

 \item $g_{8} = 5 \mod 2^{e_{2}}$.

 Then the $g_{p}$ (and the extra $g_{4}$ and $g_{8}$ if $2^{e_{2}}\geq 2$) are
 independent generators of $\Z/q\Z^{*}$, i.e. every $m$ in $(\Z/q\Z)^{*}$ can be
 written uniquely as $\prod_{p} g_{p}^{m_{p}}$, where $m_{p}$ is defined modulo
 the order $o_{p}$ of $g_{p}$ and $p \in S_{q}$, the set of prime divisors of
 $q$ together with $4$ if $4 \mid q$ and $8$ if $8 \mid q$. Note that the
 $g_{p}$
 are in general \emph{not} SNF generators as produced by \kbd{znstar} whenever
 $\omega(q) \geq 2$, although their number is the same. They however allow
 to handle the finite abelian group $(\Z/q\Z)^{*}$ in a fast and elegant way.
 (Which unfortunately does not generalize to ray class groups or Hecke
 characters.)

 The Conrey logarithm of $m$ is the vector $(m_{p})_{p\in S_{q}}$. The inverse
 function \tet{znconreyexp} recovers the Conrey label $m$ from a character.

 \bprog
 ? G = znstar(126000, 1);
 ? znconreylog(G,1)
 %2 = [0, 0, 0, 0, 0]~
 ? znconreyexp(G, %)
 %3 = 1
 ? znconreylog(G,2)  \\ 2 is not coprime to modulus !!!
   ***   at top-level: znconreylog(G,2)
   ***                 ^-----------------
   *** znconreylog: elements not coprime in Zideallog:
     2
     126000
   ***   Break loop: type 'break' to go back to GP prompt
 break>
 ? znconreylog(G,11) \\ wrt. Conrey generators
 %4 = [0, 3, 1, 76, 4]~
 ? log11 = ideallog(,11,G)   \\ wrt. SNF generators
 %5 = [178, 3, -75, 1, 0]~
 @eprog\noindent

 For convenience, we allow to input the ordinary discrete log of $m$,
 $\kbd{ideallog(,m,bid)}$, which allows to convert discrete logs
 from \kbd{bid.gen} generators to Conrey generators.
 \bprog
 ? znconreylog(G, log11)
 %7 = [0, 3, 1, 76, 4]~
 @eprog\noindent We also allow a character (\typ{VEC}) on \kbd{bid.gen} and
 return its representation on the Conrey generators.
 \bprog
 ? G.cyc
 %8 = [300, 12, 2, 2, 2]
 ? chi = [10,1,0,1,1];
 ? znconreylog(G, chi)
 %10 = [1, 3, 3, 10, 2]~
 ? n = znconreyexp(G, chi)
 %11 = 84149
 ? znconreychar(G, n)
 %12 = [10, 1, 0, 1, 1]
 @eprog
