bridge/class-master/depend/pari/src/basemath/bb_group.c
/* Let G be a cyclic group of order o>1. Returns a (random) generator */
Let G be a cyclic group of order o>1. Returns a (random) generator
Let G be a cyclic group of order o > 1 . Returns a ( random ) generator
GEN
gen_gener(GEN o, void *E, const struct bb_group *grp)
{
  pari_sp ltop = avma, av;
  long i, lpr;
  GEN F, N, pr, z=NULL;
  F = get_arith_ZZM(o);
  N = gel(F,1); pr = gel(F,2); lpr = lgcols(pr);
  av = avma;
  for (i = 1; i < lpr; i++)
  {
    GEN l = gcoeff(pr,i,1);
    long e = itos(gcoeff(pr,i,2));
    GEN r = diviiexact(N,powis(l,e));
    GEN zetan, zl = gen_lgener(l,e,r,&zetan,E,grp);
    z = i==1 ? zl: grp->mul(E,z,zl);
    if (gc_needed(av,2))
    { 
      if(DEBUGMEM>1) pari_warn(warnmem,"gen_gener");
      z = gerepileupto(av, z);
    }
  }
  return gerepileupto(ltop, z);
}
GEN gen_gener ( GEN o , void * E , const struct bb_group * grp ) { pari_sp ltop = avma , av ; long i , lpr ; GEN F , N , pr , z = NULL ; F = get_arith_ZZM ( o ) ; N = gel ( F , 1 ) ; pr = gel ( F , 2 ) ; lpr = lgcols ( pr ) ; av = avma ; for ( i = 1 ; i < lpr ; i ++ ) { GEN l = gcoeff ( pr , i , 1 ) ; long e = itos ( gcoeff ( pr , i , 2 ) ) ; GEN r = diviiexact ( N , powis ( l , e ) ) ; GEN zetan , zl = gen_lgener ( l , e , r , & zetan , E , grp ) ; z = i == 1 ? zl : grp -> mul ( E , z , zl ) ; if ( gc_needed ( av , 2 ) ) { if ( DEBUGMEM > 1 ) pari_warn ( warnmem , " " ) ; z = gerepileupto ( av , z ) ; } } return gerepileupto ( ltop , z ) ; }
Let G be a cyclic group of order o>1.
Let G be a cyclic group of order o > 1 .
/* n can have lots of prime factors*/