The command
\l creates a log file called by default pari.log
In the next two lines I generate two large primes as factors of
random numbers. The answers are given as matrices.
(09:10)
gp > factor(9873487593794857872759730457827983857893794857972985704523)
%1
=
[3
1]
[3457849
1]
[31668164536226264201041
1]
[30055254729705346546970152849
1]
(09:11)
gp > factor(8394789579270578937498572508475082734857958475811111)
%2
=
[3
1]
[70879
1]
[39479439510859252799364985907791601343406643603
1]
Next I create a composite integer
n which
is a product of two large primes.
(09:12)
gp > n=%1[4,1]*%2[3,1]
%3
= 1186564611084868690886822575074728078567619925083753057867407227894978074947
I ask PARI if
n is prime. The answer is instantenous NO (given as truth value 0 in less than a
second)
(09:12)
gp > isprime(n)
%4
= 0
For comparison: it takes PARI 52 minutes to actually factor n.
(09:12)
gp > factor(n)
%5
=
[30055254729705346546970152849
1]
[39479439510859252799364985907791601343406643603
1]
Here I do the primality test by hand. a is a
randomly chosen number mod n and a^(n-1) is not one mod n
so n is not prime.
(10:04)
gp > a=Mod(938745,n)
%6
= Mod(938745,
1186564611084868690886822575074728078567619925083753057867407227894978074947)
(10:04)
gp > a^(n-1)
%7
= Mod(948108788665754975270179520312202099971058880986156262640240616277220083349,
1186564611084868690886822575074728078567619925083753057867407227894978074947)
The following command closes the log file.
(10:04)
gp > \l
log = 0 (off)
[logfile
was "pari.log"]