[libmath-prime-util-perl] 100/181: PP legendre phi wasn't making enough primes via public API

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


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

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

commit 4edb0a1af046339e0350fb211d5c8e0e3da11931
Author: Dana Jacobsen <dana at acm.org>
Date:   Thu Jan 2 02:25:56 2014 -0800

    PP legendre phi wasn't making enough primes via public API
---
 lib/Math/Prime/Util/PP.pm | 2 +-
 t/19-moebius.t            | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 0f083be..c8e61ee 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -636,7 +636,7 @@ sub _mapes {
 sub _legendre_phi {
   my ($x, $a, $primes) = @_;
   return _mapes($x,$a) if $a <= 6;
-  $primes = primes($a + 1) unless defined $primes;
+  $primes = primes(next_prime($a)) unless defined $primes;
   return ($x > 0 ? 1 : 0) if $x < $primes->[$a];
 
   my $sum = 0;
diff --git a/t/19-moebius.t b/t/19-moebius.t
index 6287411..321ca30 100644
--- a/t/19-moebius.t
+++ b/t/19-moebius.t
@@ -234,6 +234,8 @@ my @kroneckers = (
   [8,21,-1],
   [5,21,1],
   [5,1237,-1],
+  [10, 49, 1],
+  [123,4567,-1],
   [3,18,0], [3,-18,0],
   [-2, 0, 0],  [-1, 0, 1],  [ 0, 0, 0],  [ 1, 0, 1],  [ 2, 0, 0],
   [-2, 1, 1],  [-1, 1, 1],  [ 0, 1, 1],  [ 1, 1, 1],  [ 2, 1, 1],

-- 
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