[libmath-prime-util-perl] 06/29: primality certificate edge cases
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:48:15 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 ef4608453a568cdaa795c9e49aeefaa4be334e56
Author: Dana Jacobsen <dana at acm.org>
Date: Mon May 6 16:06:19 2013 -0700
primality certificate edge cases
---
TODO | 8 ++++++--
lib/Math/Prime/Util.pm | 8 ++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/TODO b/TODO
index 39a2833..0ed5c9c 100644
--- a/TODO
+++ b/TODO
@@ -33,7 +33,11 @@
- Implement S2 calculation for LMO prime count.
-- Add Sage output style verification. Looks like NZMATH has ECPP but doesn't
- produce a certificate. Adding a Primo parser (see WraithX's code) would
+- Adding a Primo certificate parser (see WraithX's code) would
be awesome, but may be a lot more work. It would still be nice to have yet
another independent codebase for this.
+
+- Big features:
+ - LMO prime count
+ - ECPP primality proof
+ - QS factoring
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index e5e77b2..0a7f465 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1698,12 +1698,12 @@ sub verify_prime {
my @pdata = @_;
my $verbose = $_Config{'verbose'};
- # Empty input = no certificate = not prime
- return 0 if scalar @pdata == 0;
-
# Handle case of being handed a reference to the certificate.
@pdata = @{$pdata[0]} if scalar @pdata == 1 && ref($pdata[0]) eq 'ARRAY';
+ # Empty input = no certificate = not prime
+ return 0 if scalar @pdata == 0;
+
my $n = shift @pdata;
if (length($n) == 1) {
return 1 if $n =~ /^[2357]$/;
@@ -1909,7 +1909,7 @@ sub verify_prime {
warn "verify_prime: incorrect AGKM block format\n";
return 0;
}
- if ($block->[0] != $q) {
+ if (Math::BigInt->new("$block->[0]") != Math::BigInt->new("$q")) {
warn "verify_prime: incorrect AGKM block format: block n != q\n";
return 0;
}
--
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