bridge/class-master/depend/pari/src/basemath/galconj.c
/* List of subgroups of (Z/mZ)^* whose order divide o, and return the list
 * of their elements, sorted by increasing order */
List of subgroups of (Z/mZ)^* whose order divide o, and return the list
of their elements, sorted by increasing order
List of subgroups of ( Z / mZ ) ^ * whose order divide o and return the list of their elements sorted by increasing order
static GEN
listznstarelts(long m, long o)
{
  pari_sp av = avma;
  GEN L, zn, zns;
  long i, phi, ind, l;
  if (m == 2) retmkvec(mkvecsmall(1));
  zn = znstar(stoi(m));
  phi = itos(gel(zn,1));
  o = ugcd(o, phi); 
  zns = znstar_small(zn);
  L = cgetg(o+1, t_VEC);
  for (i=1,ind = phi; ind; ind -= phi/o, i++) 
    gel(L,i) = subgrouplist(gel(zn,2), mkvec(utoipos(ind)));
  L = shallowconcat1(L); l = lg(L);
  for (i = 1; i < l; i++) gel(L,i) = znstar_hnf_elts(zns, gel(L,i));
  return gerepilecopy(av, L);
}
static GEN listznstarelts ( long m , long o ) { pari_sp av = avma ; GEN L , zn , zns ; long i , phi , ind , l ; if ( m == 2 ) retmkvec ( mkvecsmall ( 1 ) ) ; zn = znstar ( stoi ( m ) ) ; phi = itos ( gel ( zn , 1 ) ) ; o = ugcd ( o , phi ) ; zns = znstar_small ( zn ) ; L = cgetg ( o + 1 , t_VEC ) ; for ( i = 1 , ind = phi ; ind ; ind -= phi / o , i ++ ) gel ( L , i ) = subgrouplist ( gel ( zn , 2 ) , mkvec ( utoipos ( ind ) ) ) ; L = shallowconcat1 ( L ) ; l = lg ( L ) ; for ( i = 1 ; i < l ; i ++ ) gel ( L , i ) = znstar_hnf_elts ( zns , gel ( L , i ) ) ; return gerepilecopy ( av , L ) ; }
List of subgroups of (Z/mZ)^* whose order divide o, and return the list
 of their elements, sorted by increasing order
List of subgroups of ( Z / mZ ) ^ * whose order divide o and return the list of their elements sorted by increasing order
/* do we impose this on input ? */ /* by *decreasing* exact index */