Math-Primality
view release on metacpan or search on metacpan
spec/bpsw/trn.c view on Meta::CPAN
return(n); \
}
/* This implementation of the algorithm assumes N is an odd integer > 2,
so we first eliminate all N < 3 and all even N. As a practical matter,
we also need to filter out all perfect square values of N, such as
1093^2 (a base-2 strong pseudoprime); this is because we will later
require an integer D for which Jacobi(D,N) = -1, and no such integer
exists if N is a perfect square. The algorithm as written would
still eventually return zero in this case, but would require
nearly sqrt(N)/2 iterations. */
iComp2=mpz_cmp_si(mpzN, 2);
if(iComp2 < 0)return(0);
if(iComp2==0)return(1);
if(mpz_even_p(mpzN))return(0);
if(mpz_perfect_square_p(mpzN))return(0);
/* Allocate storage for the mpz_t variables. Most require twice
the storage of mpzN, since multiplications of order O(mpzN)*O(mpzN)
will be performed. */
spec/bpsw/trn.c view on Meta::CPAN
return(n); \
}
/* This implementation of the algorithm assumes N is an odd integer > 2,
so we first eliminate all N < 3 and all even N. As a practical matter,
we also need to filter out all perfect square values of N, such as
1093^2 (a base-2 strong pseudoprime); this is because we will later
require an integer D for which Jacobi(D,N) = -1, and no such integer
exists if N is a perfect square. The algorithm as written would
still eventually return zero in this case, but would require
nearly sqrt(N)/2 iterations. */
iComp2=mpz_cmp_si(mpzN, 2);
if(iComp2 < 0)return(0);
if(iComp2==0)return(1);
if(mpz_even_p(mpzN))return(0);
if(mpz_perfect_square_p(mpzN))return(0);
/* Allocate storage for the mpz_t variables. Most require twice
the storage of mpzN, since multiplications of order O(mpzN)*O(mpzN)
will be performed. */
( run in 0.518 second using v1.01-cache-2.11-cpan-71847e10f99 )