- 注册时间
- 2008-11-26
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 149497
- 在线时间
- 小时
|
楼主 |
发表于 2008-11-30 20:32:07
|
显示全部楼层
看看帮助文件吧
3.4.35 isprime(x, {flag = 0}): true (1) if x is a prime number, false (0) otherwise. A prime number
is a positive integer having exactly two distinct divisors among the natural numbers, namely 1 and
itself.
This routine proves or disproves rigorously that a number is prime, which can be very slow
when x is indeed prime and has more than 1000 digits, say. Use ispseudoprime to quickly check
for compositeness. See also factor.
If flag = 0, use a combination of Baillie-PSW pseudo primality test (see ispseudoprime),
Selfridge “p − 1” test if x − 1 is smooth enough, and Adleman-Pomerance-Rumely-Cohen-Lenstra
(APRCL) for general x.
If flag = 1, use Selfridge-Pocklington-Lehmer “p − 1” test and output a primality certificate
as follows: return
• 0 if x is composite,
• 1 if x is small enough that passing Baillie-PSW test guarantees its primality (currently
x < 1015),
• 2 if x is a large prime whose primality could only sensibly be proven (given the algorithms
implemented in PARI) using the APRCL test.
• Otherwise (x is large and x − 1 is smooth) output a three column matrix as a primality
certificate. The first column contains prime divisors p of x − 1 (such that Qpvp(x−1) > x1/3),
the second the corresponding elements ap as in Proposition 8.3.1 in GTM 138 , and the third the
output of isprime(p,1).
The algorithm fails if one of the pseudo-prime factors is not prime, which is exceedingly unlikely
and well worth a bug report. Note that if you monitor isprime at a high enough debug level, you
may see warnings about untested integers being declared primes. This is normal: we ask for partial
factorisations (sufficient to prove primality if the unfactored part is not too large), and factor
warns us that the cofactor hasn’t been tested. It may or may not be tested later, and may or may
not be prime. This does not affect the validity of the whole isprime procedure.
If flag = 2, use APRCL.
The library syntax is GEN gisprime(GEN x, long flag).
复制后粘贴的结果并不理想,主要是要用数学编辑工具编辑一下,不过我有些懒,同时我也不会
使用,我还是推荐你去读pari的pdf文件!应该能读懂的吧, |
|