bridge/class-master/depend/pari/src/modules/krasner.c
/* return the number of extensions corresponding to (e,f,j) */
return the number of extensions corresponding to (e,f,j)
return the number of extensions corresponding to ( e f j )
static GEN
NumberExtensions(KRASNER_t *data)
{
  ulong pp, pa;
  long e, a, b;
  GEN p, q, s0, p1;
  e = data->e;
  p = data->p;
  q = data->q;
  a = data->a; 
  b = data->b; 
  if (is_bigint(p)) 
    return b == 0? utoipos(e): mulsi(e, data->qm1);
  pp = p[2];
  switch(a)
  {
    case 0:  pa = 1;  s0 = utoipos(e); break;
    case 1:  pa = pp; s0 = mului(e, powiu(q, e / pa)); break;
    default:
      pa = upowuu(pp, a); 
      s0 = mulsi(e, powiu(q, (e / pa) * ((pa - 1) / (pp - 1))));
  }
  if (b == 0) return s0;
  p1 = powiu(q, sdivsi(b-1, muluu(pa, pp)));
  return mulii(mulii(data->qm1, s0), p1);
}
static GEN NumberExtensions ( KRASNER_t * data ) { ulong pp , pa ; long e , a , b ; GEN p , q , s0 , p1 ; e = data -> e ; p = data -> p ; q = data -> q ; a = data -> a ; b = data -> b ; if ( is_bigint ( p ) ) return b == 0 ? utoipos ( e ) : mulsi ( e , data -> qm1 ) ; pp = p [ 2 ] ; switch ( a ) { case 0 : pa = 1 ; s0 = utoipos ( e ) ; break ; case 1 : pa = pp ; s0 = mului ( e , powiu ( q , e / pa ) ) ; break ; default : pa = upowuu ( pp , a ) ; s0 = mulsi ( e , powiu ( q , ( e / pa ) * ( ( pa - 1 ) / ( pp - 1 ) ) ) ) ; } if ( b == 0 ) return s0 ; p1 = powiu ( q , sdivsi ( b - 1 , muluu ( pa , pp ) ) ) ; return mulii ( mulii ( data -> qm1 , s0 ) , p1 ) ; }
return the number of extensions corresponding to (e,f,j)
return the number of extensions corresponding to ( e f j )
/* floor(j/e) <= v_p(e), hence p^a | e */ /* j % e */ /* implies a = 0 */ /* p^a */ /* s0 = e * q^(e*sum(p^-i, i=1...a)) */ /* q^floor((b-1)/p^(a+1)) */