bridge/class-master/depend/pari/src/basemath/ellsea.c
/* A partition of compile_atkin in baby and giant is represented as the binary
   developpement of an integer; if the i-th bit is 1, the i-th prime in
   compile-atkin is a baby. The optimum is obtained when the ratio between
   the number of possibilities for traces modulo giants (p_g) and babies (p_b)
   is near 3/4. */
A partition of compile_atkin in baby and giant is represented as the binary
developpement of an integer; if the i-th bit is 1, the i-th prime in
compile-atkin is a baby. The optimum is obtained when the ratio between
the number of possibilities for traces modulo giants (p_g) and babies (p_b)
is near 3/4.
A partition of compile_atkin in baby and giant is represented as the binary developpement of an integer ; if the i - th bit is 1 the i - th prime in compile - atkin is a baby . The optimum is obtained when the ratio between the number of possibilities for traces modulo giants ( p_g ) and babies ( p_b ) is near 3 / 4 .
static long
separation(GEN cnt)
{
  pari_sp btop;
  long k = lg(cnt)-1, l = (1L<<k)-1, best_i, i, j;
  GEN best_r, P, P3, r;
  P = gen_1;
  for (j = 1; j <= k; ++j) P = mulis(P, cnt[j]);
  P3 = mulsi(3, P);
  btop = avma;
  best_i = 0;
  best_r = P3;
  for (i = 1; i < l; i++)
  {
    GEN p_b = gen_1;
    for (j = 0; j < k; j++)
      if (i & (1L<<j)) p_b = mulis(p_b, cnt[1+j]);
    r = subii(shifti(sqri(p_b), 2), P3); 
    if (!signe(r)) { best_i = i; break; }
    if (abscmpii(r, best_r) < 0) { best_i = i; best_r = r; }
    if (gc_needed(btop, 1))
      best_r = gerepileuptoint(btop, best_r);
  }
  return best_i;
}
static long separation ( GEN cnt ) { pari_sp btop ; long k = lg ( cnt ) - 1 , l = ( 1L << k ) - 1 , best_i , i , j ; GEN best_r , P , P3 , r ; P = gen_1 ; for ( j = 1 ; j <= k ; ++ j ) P = mulis ( P , cnt [ j ] ) ; P3 = mulsi ( 3 , P ) ; btop = avma ; best_i = 0 ; best_r = P3 ; for ( i = 1 ; i < l ; i ++ ) { GEN p_b = gen_1 ; for ( j = 0 ; j < k ; j ++ ) if ( i & ( 1L << j ) ) p_b = mulis ( p_b , cnt [ 1 + j ] ) ; r = subii ( shifti ( sqri ( p_b ) , 2 ) , P3 ) ; if ( ! signe ( r ) ) { best_i = i ; break ; } if ( abscmpii ( r , best_r ) < 0 ) { best_i = i ; best_r = r ; } if ( gc_needed ( btop , 1 ) ) best_r = gerepileuptoint ( btop , best_r ) ; } return best_i ; }
A partition of compile_atkin in baby and giant is represented as the binary
developpement of an integer; if the i-th bit is 1, the i-th prime in
compile-atkin is a baby.
A partition of compile_atkin in baby and giant is represented as the binary developpement of an integer ; if the i - th bit is 1 the i - th prime in compile - atkin is a baby .
/* p_b * p_g = P is constant */ /* scan all possibilities */ /* (p_b/p_g - 3/4)*4*P */