bridge/class-master/depend/pari/src/basemath/arith1.c
/* Return NULL if p is found to be composite */
Return NULL if p is found to be composite
Return NULL if p is found to be composite
static GEN
Fp_2gener_all(long e, GEN p)
{
  GEN y, m;
  long k;
  GEN q = shifti(subiu(p,1), -e); 
  if (e==0 && !equaliu(p,2)) return NULL;
  for (k=2; ; k++)
  {
    long i = krosi(k, p);
    if (i >= 0)
    {
      if (i) continue;
      return NULL;
    }
    y = m = Fp_pow(utoi(k), q, p);
    for (i=1; i<e; i++)
      if (equali1(m = Fp_sqr(m, p))) break;
    if (i == e) break; 
  }
  return y;
}
static GEN Fp_2gener_all ( long e , GEN p ) { GEN y , m ; long k ; GEN q = shifti ( subiu ( p , 1 ) , - e ) ; if ( e == 0 && ! equaliu ( p , 2 ) ) return NULL ; for ( k = 2 ; ; k ++ ) { long i = krosi ( k , p ) ; if ( i >= 0 ) { if ( i ) continue ; return NULL ; } y = m = Fp_pow ( utoi ( k ) , q , p ) ; for ( i = 1 ; i < e ; i ++ ) if ( equali1 ( m = Fp_sqr ( m , p ) ) ) break ; if ( i == e ) break ; } return y ; }
Return NULL if p is found to be composite
Return NULL if p is found to be composite
/* q = (p-1)/2^oo is odd */ /* success */