[libmath-prime-util-perl] 18/29: More test coverage

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:48:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.27
in repository libmath-prime-util-perl.

commit 1660bcba4796ed4b5e1e0981725138a159c1649e
Author: Dana Jacobsen <dana at acm.org>
Date:   Thu May 16 20:00:01 2013 -0700

    More test coverage
---
 MANIFEST                  |   1 +
 TODO                      |   8 ++-
 XS.xs                     |  23 ++-------
 lehmer.c                  |   6 ++-
 lib/Math/Prime/Util.pm    |  11 ++--
 lib/Math/Prime/Util/PP.pm |   2 +-
 t/23-primality-proofs.t   | 126 ++++++++++++++++++++++++++++++++++++++++++++++
 t/80-pp.t                 |  99 +++++++++++++++++++++++++++++++++---
 t/81-bignum.t             |  50 ------------------
 9 files changed, 237 insertions(+), 89 deletions(-)

diff --git a/MANIFEST b/MANIFEST
index f31cf32..298c91e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -78,6 +78,7 @@ t/19-moebius.t
 t/20-primorial.t
 t/21-conseq-lcm.t
 t/22-aks-prime.t
+t/23-primality-proofs.t
 t/30-relations.t
 t/31-threading.t
 t/50-factoring.t
diff --git a/TODO b/TODO
index f9e3def..b9417b5 100644
--- a/TODO
+++ b/TODO
@@ -34,11 +34,9 @@
   be awesome, but may be a lot more work.  It would still be nice to have yet
   another independent codebase for this.
 
+- Similar to the previous, having a method to convert our certificates into
+  Primo-style ones would be useful for easy independent verification.
+
 - Big features:
    - LMO prime count
    - QS factoring
-
-- Test coverage:
-  PP miller-rabin with bigint
-  PP ecm_factor stage 2
-  PP primality_proof_bls75 that needs to find factors
diff --git a/XS.xs b/XS.xs
index ba3199e..2dfcccf 100644
--- a/XS.xs
+++ b/XS.xs
@@ -103,7 +103,6 @@ _XS_prime_maxbits()
 SV*
 sieve_primes(IN UV low, IN UV high)
   PREINIT:
-    const unsigned char* sieve;
     AV* av = newAV();
   CODE:
     if (low <= high) {
@@ -216,7 +215,7 @@ erat_primes(IN UV low, IN UV high)
     RETVAL
 
 
-#define SIMPLE_FACTOR(func, n, rounds) \
+#define SIMPLE_FACTOR(func, n, ...) \
     if (n <= 1) { \
       XPUSHs(sv_2mortal(newSVuv( n ))); \
     } else { \
@@ -228,7 +227,7 @@ erat_primes(IN UV low, IN UV high)
       else { \
         UV factors[MPU_MAX_FACTORS+1]; \
         int i, nfactors; \
-        nfactors = func(n, factors, rounds); \
+        nfactors = func(n, factors, ## __VA_ARGS__); \
         for (i = 0; i < nfactors; i++) { \
           XPUSHs(sv_2mortal(newSVuv( factors[i] ))); \
         } \
@@ -287,23 +286,7 @@ pminus1_factor(IN UV n, IN UV B1 = 1*1024*1024, IN UV B2 = 0)
   PPCODE:
     if (B2 == 0)
       B2 = 10*B1;
-    if (n <= 1) {
-      XPUSHs(sv_2mortal(newSVuv( n )));
-    } else {
-      while ( (n% 2) == 0 ) {  n /=  2;  XPUSHs(sv_2mortal(newSVuv( 2 ))); }
-      while ( (n% 3) == 0 ) {  n /=  3;  XPUSHs(sv_2mortal(newSVuv( 3 ))); }
-      while ( (n% 5) == 0 ) {  n /=  5;  XPUSHs(sv_2mortal(newSVuv( 5 ))); }
-      if (n == 1) {  /* done */ }
-      else if (_XS_is_prime(n)) { XPUSHs(sv_2mortal(newSVuv( n ))); }
-      else {
-        UV factors[MPU_MAX_FACTORS+1];
-        int i, nfactors;
-        nfactors = pminus1_factor(n, factors, B1, B2);
-        for (i = 0; i < nfactors; i++) {
-          XPUSHs(sv_2mortal(newSVuv( factors[i] )));
-        }
-      }
-    }
+    SIMPLE_FACTOR(pminus1_factor, n, B1, B2);
 
 int
 _XS_miller_rabin(IN UV n, ...)
diff --git a/lehmer.c b/lehmer.c
index 848f6d9..214d205 100644
--- a/lehmer.c
+++ b/lehmer.c
@@ -663,6 +663,7 @@ UV _XS_lehmer_pi(UV n)
 
 UV _XS_LMO_pi(UV n)
 {
+#if 0
   UV a, b, sum, i, lastprime, lastpc, lastw, lastwpc;
   UV n13, n12, n23;
   IV S1;
@@ -752,6 +753,9 @@ UV _XS_LMO_pi(UV n)
   Safefree(primes);
   sum = P2 + S1 + S2;
   return sum;
+#else
+  croak("not implemented: LMO(%lu)", (unsigned long) n);
+#endif
 }
 
 
@@ -778,7 +782,7 @@ int main(int argc, char *argv[])
   if      (!strcasecmp(method, "lehmer"))   { pi = _XS_lehmer_pi(n);      }
   else if (!strcasecmp(method, "meissel"))  { pi = _XS_meissel_pi(n);     }
   else if (!strcasecmp(method, "legendre")) { pi = _XS_legendre_pi(n);    }
-  else if (!strcasecmp(method, "lmo"))      { pi = _XS_LMO_pi(n);    }
+  else if (!strcasecmp(method, "lmo"))      { pi = _XS_LMO_pi(n);         }
   else if (!strcasecmp(method, "sieve"))    { pi = _XS_prime_count(2, n); }
   else {
     printf("method must be one of: lehmer, meissel, legendre, lmo, or sieve\n");
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index a695e29..ce2c220 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1745,7 +1745,7 @@ sub verify_prime {
   if ($method eq 'Pratt' || $method eq 'Lucas') {
     # Based on Lucas primality test, which requires full n-1 factorization.
     if (scalar @pdata != 2 || (ref($pdata[0]) ne 'ARRAY') || (ref($pdata[1]) eq 'ARRAY')) {
-      warn "verify_prime: incorrect Pratt format, must have factors and a value\n";
+      print "verify_prime: incorrect Pratt format, must have factors and a value\n" if $verbose;
       return 0;
     }
     my @factors = @{shift @pdata};
@@ -1775,7 +1775,10 @@ sub verify_prime {
       push @prime_factors, $f;
       $factors_seen{"$f"} = 1;
     }
-    croak "Pratt error: n-1 not completely factored" unless $B == 1;
+    if ($B != 1) {
+      print "verify_prime: n-1 not completely factored" if $verbose;
+      return 0;
+    }
 
     # 1. a must be co-prime to n.
     if (Math::BigInt::bgcd($a, $n) != 1) {
@@ -1993,7 +1996,7 @@ sub verify_prime {
       # Compute V = qU, check V = point at infinity
       $ECP->mul( $q );
       if (! $ECP->is_infinity) {
-        warn "verify_prime: AGKM point does not multiply correctly.\n";
+        print "verify_prime: AGKM point does not multiply correctly.\n" if $verbose;
         return 0;
       }
     }
@@ -2004,7 +2007,7 @@ sub verify_prime {
     return 1;
   }
 
-  warn "verify_prime: Unknown method: '$method'.\n";
+  print "verify_prime: Unknown method: '$method'.\n" if $verbose;
   return 0;
 }
 
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 86ae28b..c3494a0 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -1799,7 +1799,7 @@ sub ecm_factor {
           }
           foreach my $i (@p) {
             next unless $i > $m;
-            next if is_prime($m+$m-$i);
+            next if $i > ($m+$m) || is_prime($m+$m-$i);
             $g = ($g * ($S2x - $nqx[$i-$m])) % $n;
           }
           $f = Math::BigInt::bgcd($g, $n);
diff --git a/t/23-primality-proofs.t b/t/23-primality-proofs.t
new file mode 100644
index 0000000..470039c
--- /dev/null
+++ b/t/23-primality-proofs.t
@@ -0,0 +1,126 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use Test::More;
+use Math::Prime::Util qw/is_prime is_provable_prime is_provable_prime_with_cert
+                         prime_certificate verify_prime
+                         prime_get_config
+                        /;
+use Math::BigInt try => 'GMP';
+
+my $extra = defined $ENV{EXTENDED_TESTING} && $ENV{EXTENDED_TESTING};
+
+my @plist = qw/20907001 809120722675364249 677826928624294778921
+               980098182126316404630169387/;
+
+## This is too slow without Math::Prime::Util::GMP.
+#push @plist, '3364125245431456304736426076174232972735419017865223025179282077503701'
+#             if prime_get_config->{'gmp'};
+#
+#push @plist, '6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151'
+#             if $extra
+#             && (prime_get_config->{'gmp'} || Math::BigInt->config()->{lib} eq 'Math::BigInt::GMP');
+#
+#push @plist, '531137992816767098689588206552468627329593117727031923199444138200403559860852242739162502265229285668889329486246501015346579337652707239409519978766587351943831270835393219031728127'
+#             if $extra && prime_get_config->{'gmp'};
+
+ at plist = sort { $a<=>$b }
+         map { $_ > ~0 ? Math::BigInt->new("$_") : $_ }
+         @plist;
+
+plan tests => 0
+            + 2 # is_provable_prime
+            + 6 * scalar(@plist)
+            + 6 # hand-done proofs
+            + 17 # verification failures
+            + 0;
+
+is( is_provable_prime(871139809), 0, "871139809 is composite" );
+is( is_provable_prime(1490266103), 2, "1490266103 is provably prime" );
+
+foreach my $p (@plist) {
+ 
+  ok( is_prime($p), "$p is prime" );
+  my($isp, $cert_ref) = is_provable_prime_with_cert($p);
+  is( $isp, 2, "   is_provable_prime_with_cert returns 2" );
+  ok( defined($cert_ref) && ref($cert_ref) eq 'ARRAY' && scalar(@$cert_ref) >= 1,
+      "   certificate is non-null" );
+  ok( verify_prime($cert_ref), "   verification of certificate reference done" );
+  # Note, in some cases the two certs could be non-equal (but both must be valid!)
+  my @cert = prime_certificate($p);
+  ok( scalar(@cert) >= 1, "   prime_certificate is also non-null" );
+  # TODO: compare certificates and skip if equal
+  ok( verify_prime(@cert), "   verification of prime_certificate done" );
+}
+
+# Some hand-done proofs
+SKIP: {
+  skip "Skipping 2**521-1 verification without Math::BigInt::GMP", 1
+       unless Math::BigInt->config()->{lib} eq 'Math::BigInt::GMP';
+  my @proof = ('6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151', 'n-1',
+  [ 2,3,5,11,17,31,41,53,131,157,521,1613,61681,8191,42641,858001,51481, '7623851', '308761441' ],
+  [ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ] );
+  ok( verify_prime(@proof), "2**521-1 primality proof verified" );
+}
+SKIP: {
+  skip "Skipping 2**607-1 verification without Math::BigInt::GMP", 1
+       unless Math::BigInt->config()->{lib} eq 'Math::BigInt::GMP';
+  my @proof = ('531137992816767098689588206552468627329593117727031923199444138200403559860852242739162502265229285668889329486246501015346579337652707239409519978766587351943831270835393219031728127', 'n-1',
+  [ 2,3,7,607,'112102729', '341117531003194129', '7432339208719',
+    ['845100400152152934331135470251', 'n-1',
+      [2,5,11,31,41,101,251,601,1801],
+      [2,3,3,3,3,2,3,3,3]
+    ] ],
+  [ 3,5,3,2,3,3,3,3 ] );
+  ok( verify_prime(@proof), "2**607-1 primality proof verified" );
+}
+{
+  my @proof = ('809120722675364249', "n-1", ["B", 20000, '22233477760919', 2], [2, 4549], [3, 2]);
+  ok( verify_prime(@proof), "n-1 T7 primality proof of 809120722675364249 verified" );
+}
+{
+  my @proof = (20907001, "Pratt", [ 2,
+                                 3,
+                                 5,
+                                 [23,"Pratt",[2,[11,"Pratt",[2,5],2]],5],
+                                 [101, "Pratt", [2, 5], 2],
+                               ], 14 );
+  ok( verify_prime(@proof), "simple Lucas/Pratt proof verified" );
+}
+{
+  my @proof = ('3364125245431456304736426076174232972735419017865223025179282077503701', 'n-1',
+    [2,5,127, ['28432789963853652887491983185920687231739655787', 'n-1',
+                [ 2,3,163,650933, [ '44662634059309451871488121651101494489', 'n-1',
+                                    [ 2,3,23,4021,2321273 ],
+                                    [ 11, 2, 2, 2, 2 ]
+                                  ] ],
+                [ 2, 2, 2, 2, 2 ]
+              ],
+              '9316417838190714313' ],
+    [ 2, 2, 2, 2, 2 ]);
+  ok( verify_prime(@proof), "simple n-1 proof verified" );
+}
+{
+  my @proof = ('677826928624294778921',"AGKM", ['677826928624294778921', '404277700094248015180', '599134911995823048257', '677826928656744857936', '104088901820753203', ['2293544533', '356794037129589115041']], ['104088901820753203', '0', '73704321689372825', '104088902465395836', '1112795797', ['3380482019', '53320146243107032']], ['1112795797', '0', '638297481', '1112860899', '39019', ['166385704', '356512285']]);
+  ok( verify_prime(@proof), "ECPP primality proof of 677826928624294778921 verified" );
+}
+
+# Failures for verify_prime
+is( verify_prime([]), 0, "verify null is composite" );
+is( verify_prime([2]), 1, "verify [2] is prime" );
+is( verify_prime([9]), 0, "verify [9] is composite" );
+is( verify_prime([14]), 0, "verify [14] is composite" );
+is( verify_prime(['28446744073709551615']), 0, "verify BPSW with n > 2^64 fails" );
+is( verify_prime([871139809]), 0, "verify BPSW with composite fails" );
+is( verify_prime([1490266103, 'INVALID', 1, 2, 3]), 0, "unknown method" );
+is( verify_prime([1490266103, 'Pratt', 1, 2, 3]), 0, "Pratt with wrong count" );
+is( verify_prime([1490266103, 'Pratt', 1, [2]]), 0, "Pratt with non-array arguments" );
+is( verify_prime([1490266103, 'Pratt', [1], [2]]), 0, "Pratt with non-array arguments" );
+is( verify_prime([1490266103, 'Pratt', [4,13,19,1597,1889], 5]), 0, "Pratt with non-prime factors" );
+is( verify_prime([1490266103, 'Pratt', [[4],13,19,1597,1889], 5]), 0, "Pratt with non-prime factors" );
+is( verify_prime([1490266103, 'Pratt', [2,13,29,1597,1889], 5]), 0, "Pratt with wrong factors" );
+is( verify_prime([1490266103, 'Pratt', [2,13,19,1597], 5]), 0, "Pratt with not enough factors" );
+is( verify_prime([1490266103, 'Pratt', [2,13,19,1597,1889], 1490266103]), 0, "Pratt with coprime a" );
+is( verify_prime([185156263, 'Pratt', [2,3,3,10286459], 2]), 0, "Pratt with non-psp a" );
+is( verify_prime([1490266103, 'Pratt', [2,13,19,1597,1889], 3]), 0, "Pratt with a not valid for all f" );
diff --git a/t/80-pp.t b/t/80-pp.t
index ec07338..3918760 100644
--- a/t/80-pp.t
+++ b/t/80-pp.t
@@ -222,8 +222,22 @@ my %rzvals = (
             7   =>  0.0083492773819228268397975498,
             8.5 =>  0.0028592508824156277133439825,
            20.6 =>  0.0000006293391573578212882457,
+           80   =>  8.27180612553034e-25,
+          180   =>  6.52530446799852e-55,
+);
+my %ipp = (
+  5 => 2,
+  10 => 0,
+  49 => 0,
+  347 => 2,
+  697 => 0,
+  7080233 => 2,
+  7080249 => 0,
+  17471059 => 2,
+  17471061 => 0,
+  36010357 => 2,
+  36010359 => 0,
 );
-
 
 plan tests => 1 +
               3 +
@@ -233,14 +247,22 @@ plan tests => 1 +
               2*scalar(keys %pivals_small) + scalar(keys %nthprimes_small) +
               4 + scalar(keys %pseudoprimes) +
               scalar(keys %eivals) + scalar(keys %livals) + scalar(keys %rvals) + scalar(keys %rzvals) +
-              ($extra ? 2 : 0) +  # Bigfloat RiemannZeta
+              ($extra ? 4 : 0) +  # Bigfloat RiemannZeta
               1 + 1 +    # factor
-              10 + 7*3 +  # factoring subs
+              10 + 8*3 + # factoring subs
               10 +       # AKS
-              2 +        # Lucas and BLS75 primality proofs
+              3 +        # Lucas and BLS75 primality proofs
+              3 +        # M-R and Lucas on bigint
+              13 +       # Misc util.pm functions
+              scalar(keys %ipp) +
               1;
 
-use Math::Prime::Util qw/primes prime_count_approx prime_count_lower/;
+use Math::Prime::Util qw/primes prime_count_approx prime_count_lower
+                         prime_get_config prime_set_config
+                         consecutive_integer_lcm moebius mertens euler_phi
+                         exp_mangoldt chebyshev_theta chebyshev_psi
+                         is_prob_prime
+                        /;
 use Math::BigInt try => 'GMP';
 use Math::BigFloat;
 require_ok 'Math::Prime::Util::PP';
@@ -397,6 +419,10 @@ if ($extra) {
   cmp_closeto( RiemannZeta(Math::BigFloat->new($n)), $zin, 0.00000001 * abs($zin), "Zeta($n) ~= $zin");
   ($n, $zin) = (20.6, $rzvals{20.6});
   cmp_closeto( RiemannZeta(Math::BigFloat->new($n)), $zin, 0.00000001 * abs($zin), "Zeta($n) ~= $zin");
+  ($n, $zin) = (80, $rzvals{80});
+  cmp_closeto( RiemannZeta(Math::BigFloat->new($n)), $zin, 0.00000001 * abs($zin), "Zeta($n) ~= $zin");
+  ($n, $zin) = (180, $rzvals{180});
+  cmp_closeto( RiemannZeta(Math::BigFloat->new($n)), $zin, 0.00000001 * abs($zin), "Zeta($n) ~= $zin");
 }
 
 ###############################################################################
@@ -511,6 +537,15 @@ if ($extra) {
   is(scalar @nfac, 2, "fermat finds a factor of 73786976930493367637");
   is($nfac[0] * $nfac[1], $nbig, "fermat found a correct factor");
   ok($nfac[0] != 1 && $nfac[1] != 1, "fermat didn't return a degenerate factor");
+  SKIP: {
+    # Unfortunately we can't guarantee this isn't found in stage 1.
+    skip "ecm stage 2", 3 unless $extra;
+    $nbig = Math::BigInt->new("14270401808568703916861");
+    @nfac = sort {$a<=>$b} Math::Prime::Util::PP::ecm_factor($nbig, 5, 2000, 40);
+    is(scalar @nfac, 2, "ecm(5,2000) finds a factor of 14270401808568703916861");
+    is($nfac[0] * $nfac[1], $nbig, "ecm(5,2000) found a correct factor");
+    ok($nfac[0] != 1 && $nfac[1] != 1, "ecm(5,2000) didn't return a degenerate factor");
+  }
 }
 
 ##### AKS primality test.  Be very careful with performance.
@@ -531,9 +566,57 @@ SKIP: {
 is_deeply( [Math::Prime::Util::PP::primality_proof_lucas(100003)],
            [2, [100003, "Pratt", [2, 3, 7, 2381], 2]],
            "primality_proof_lucas(100003)" );
-is_deeply( [Math::Prime::Util::PP::primality_proof_bls75(100000007)],
-           [2, [100000007, "n-1", [2, 491, 101833], [5, 2, 2]]],
-           "primality_proof_bls75(100000007)" );
+is_deeply( [Math::Prime::Util::PP::primality_proof_bls75(210596120454733723)],
+           [2, [210596120454733723, "n-1", [2, 3, 82651, 47185492693], [2, 2, 2, 2]]],
+           "primality_proof_bls75(210596120454733723)" );
+is_deeply( [Math::Prime::Util::PP::primality_proof_bls75(809120722675364249)],
+           [2, [809120722675364249, "n-1",
+               ["B", 20000, 22233477760919, 2], [2, 4549], [3, 2]]],
+           "primality_proof_bls75(809120722675364249)" );
+
+{
+  my $n = Math::BigInt->new("168790877523676911809192454171451");
+  is( miller_rabin( $n, 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47), 1, "168790877523676911809192454171451 looks prime with bases 2..52" );
+  is( miller_rabin( $n, 53), 0, "168790877523676911809192454171451 found composite with base 53" );
+  is ( is_strong_lucas_pseudoprime($n), 0, "168790877523676911809192454171451 is not a strong Lucas pseudoprime" );
+}
+
+{
+  # Test some functions usually not tested in Util.pm
+  my $xs  = prime_get_config->{'xs'};
+  my $gmp = prime_get_config->{'gmp'};
+  my $verbose = prime_get_config->{'verbose'};
+  prime_set_config(xs=>0, gmp=>0);
+
+  is( consecutive_integer_lcm(13), 360360, "consecutive_integer_lcm(13)" );
+  is( consecutive_integer_lcm(52), Math::BigInt->new("3099044504245996706400"), "consecutive_integer_lcm(52)" );
+
+  is_deeply( [moebius(513,537)],
+             [qw/0 1 1 0 1 -1 1 0 -1 0 -1 0 0 1 1 0 0 -1 0 0 1 -1 1 0 1/],
+             "moebius(513,537)" );
+
+  is( mertens(4219), -13, "mertens(4219)" );
+
+  is_deeply( [euler_phi(1513,1537)],
+             [qw/1408 756 800 756 1440 440 1260 576 936 760 1522 504 1200 648 1016 760 1380 384 1530 764 864 696 1224 512 1456/],
+             "euler_phi(1513,1537)" );
+  is( euler_phi(324234), 108072, "euler_phi(324234)" );
+
+  is( exp_mangoldt(16), 2, "exp_mangoldt of power of 2 = 2" );
+  is( exp_mangoldt(14), 1, "exp_mangoldt of even = 1" );
+  is( exp_mangoldt(21), 1, "exp_mangoldt of 21 = 1" );
+  is( exp_mangoldt(23), 23, "exp_mangoldt of 23 = 23" );
+  is( exp_mangoldt(27), 3, "exp_mangoldt of 27 (3^3) = 3" );
+
+  cmp_closeto( chebyshev_theta(27001), 26837.3487140827, 0.00027, "chebyshev_theta(27001) =~ 26837.35");
+  cmp_closeto( chebyshev_psi(87001), 86964.5577535435, 0.00087, "chebyshev_psi(87001) =~ 86964.56");
+
+  while (my($n, $isp) = each (%ipp)) {
+    is( is_prob_prime($n), $isp, "is_prob_prime($n) should be $isp" );
+  }
+
+  prime_set_config(xs=>$xs, gmp=>$gmp, verbose=>$verbose);
+}
 
 is( $_, 'this should not change', "Nobody clobbered \$_" );
 
diff --git a/t/81-bignum.t b/t/81-bignum.t
index 63e2d8d..1174d22 100644
--- a/t/81-bignum.t
+++ b/t/81-bignum.t
@@ -76,8 +76,6 @@ plan tests =>  0
              + scalar(keys %allfactors)
              + 5   # moebius, euler_phi, jordan totient
              + 15  # random primes
-             + 3   # verify_prime
-             + 2*$extra # "big" prime verification
              + 0;
 
 # Using GMP makes these tests run about 2x faster on some machines
@@ -291,51 +289,3 @@ sub check_pcbounds {
 }
 
 ###############################################################################
-
-# Provable primes
-{
-  my @proof;
-
-  @proof = (20907001, "Pratt", [ 2,
-                                 3,
-                                 5,
-                                 [23,"Pratt",[2,[11,"Pratt",[2,5],2]],5],
-                                 [101, "Pratt", [2, 5], 2],
-                               ], 14 );
-  ok( verify_prime(@proof), "simple Lucas/Pratt proof verified" );
-
-  @proof = ('3364125245431456304736426076174232972735419017865223025179282077503701', 'n-1',
-    [2,5,127, ['28432789963853652887491983185920687231739655787', 'n-1',
-                [ 2,3,163,650933, [ '44662634059309451871488121651101494489', 'n-1',
-                                    [ 2,3,23,4021,2321273 ],
-                                    [ 11, 2, 2, 2, 2 ]
-                                  ] ],
-                [ 2, 2, 2, 2, 2 ]
-              ],
-              '9316417838190714313' ],
-    [ 2, 2, 2, 2, 2 ]);
-  ok( verify_prime(@proof), "simple n-1 proof verified" );
-
-  @proof = ('677826928624294778921',"AGKM", ['677826928624294778921', '404277700094248015180', '599134911995823048257', '677826928656744857936', '104088901820753203', ['2293544533', '356794037129589115041']], ['104088901820753203', '0', '73704321689372825', '104088902465395836', '1112795797', ['3380482019', '53320146243107032']], ['1112795797', '0', '638297481', '1112860899', '39019', ['166385704', '356512285']]);
-  ok( verify_prime(@proof), "ECPP primality proof of 677826928624294778921 verified" );
-}
-
-if ($extra) {
-  my @proof;
-  #skip "Skipping bigger proofs without fast BigInt library", 2
-  #     if $bigintlib !~ /^(GMP|Pari)/;
-
-  @proof = ('6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151', 'n-1',
-  [ 2,3,5,11,17,31,41,53,131,157,521,1613,61681,8191,42641,858001,51481, '7623851', '308761441' ],
-  [ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 ] );
-  ok( verify_prime(@proof), "2**521-1 primality proof verified" );
-
-  @proof = ('531137992816767098689588206552468627329593117727031923199444138200403559860852242739162502265229285668889329486246501015346579337652707239409519978766587351943831270835393219031728127', 'n-1',
-  [ 2,3,7,607,'112102729', '341117531003194129', '7432339208719',
-    ['845100400152152934331135470251', 'n-1',
-      [2,5,11,31,41,101,251,601,1801],
-      [2,3,3,3,3,2,3,3,3]
-    ] ],
-  [ 3,5,3,2,3,3,3,3 ] );
-  ok( verify_prime(@proof), "2**607-1 primality proof verified" );
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list