[libmath-prime-util-perl] 12/14: Add large bases to pseudoprime tests
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:47:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.25
in repository libmath-prime-util-perl.
commit e6db57b30ddf02c990985943476401c2dc0d2892
Author: Dana Jacobsen <dana at acm.org>
Date: Tue Mar 19 12:37:10 2013 -0700
Add large bases to pseudoprime tests
---
examples/bench-mp-nextprime.pl | 0
examples/bench-mp-prime_count.pl | 0
examples/bench-mp-psrp.pl | 0
t/17-pseudoprime.t | 12 ++++++++++++
4 files changed, 12 insertions(+)
diff --git a/examples/bench-mp-nextprime.pl b/examples/bench-mp-nextprime.pl
old mode 100644
new mode 100755
diff --git a/examples/bench-mp-prime_count.pl b/examples/bench-mp-prime_count.pl
old mode 100644
new mode 100755
diff --git a/examples/bench-mp-psrp.pl b/examples/bench-mp-psrp.pl
old mode 100644
new mode 100755
diff --git a/t/17-pseudoprime.t b/t/17-pseudoprime.t
index 805fe9b..01e21ca 100644
--- a/t/17-pseudoprime.t
+++ b/t/17-pseudoprime.t
@@ -70,6 +70,7 @@ plan tests => 0 + 3
+ $num_pseudoprimes
+ scalar @phis
+ 1 # mr base 2 2-4k
+ + 9 # mr with large bases
+ scalar @small_lucas_trials
+ 1*$extra;
@@ -114,6 +115,17 @@ for my $phi (1 .. scalar @phis) {
is($mr2fail, 0, "MR base 2 matches is_prime for 2-4032 (excl 2047,3277)");
}
+# Verify MR for bases >= n
+is( is_strong_pseudoprime( 3, 3), 1, "spsp( 3, 3)");
+is( is_strong_pseudoprime( 11, 11), 1, "spsp( 11, 11)");
+is( is_strong_pseudoprime( 89, 5785), 1, "spsp( 89, 5785)");
+is( is_strong_pseudoprime(257, 6168), 1, "spsp(257, 6168)");
+is( is_strong_pseudoprime(367, 367), 1, "spsp(367, 367)");
+is( is_strong_pseudoprime(367, 1101), 1, "spsp(367, 1101)");
+is( is_strong_pseudoprime(49001, 921211727), 0, "spsp(49001, 921211727)");
+is( is_strong_pseudoprime( 331, 921211727), 1, "spsp( 331, 921211727)");
+is( is_strong_pseudoprime(49117, 921211727), 1, "spsp(49117, 921211727)");
+
# Verify Lucas for some small numbers
for my $n (@small_lucas_trials) {
next if $n == 5459 || $n == 5777 || $n == 10877 || $n == 16109 || $n == 18971;
--
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