bridge/class-master/depend/pari/src/basemath/arith1.c
/*Find the exact order of a assuming a^o==1*/
Find the exact order of a assuming a^o==1
Find the exact order of a assuming a^o == 1
GEN
Fp_order(GEN a, GEN o, GEN p) {
  if (lgefint(p) == 3 && (!o || typ(o) == t_INT))
  {
    ulong pp = p[2], oo = (o && lgefint(o)==3)? o[2]: pp-1;
    return utoi( Fl_order(umodiu(a, pp), oo, pp) );
  }
  return gen_order(a, o, (void*)p, &Fp_star);
}
GEN Fp_order ( GEN a , GEN o , GEN p ) { if ( lgefint ( p ) == 3 && ( ! o || typ ( o ) == t_INT ) ) { ulong pp = p [ 2 ] , oo = ( o && lgefint ( o ) == 3 ) ? o [ 2 ] : pp - 1 ; return utoi ( Fl_order ( umodiu ( a , pp ) , oo , pp ) ) ; } return gen_order ( a , o , ( void * ) p , & Fp_star ) ; }
Find the exact order of a assuming a^o==1
Find the exact order of a assuming a^o == 1