[libmath-prime-util-perl] 99/181: Add tests for legendre_phi

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 ae9cc5ed669c8ec2c892e784b81e6fbc5921b92d
Author: Dana Jacobsen <dana at acm.org>
Date:   Thu Jan 2 01:53:33 2014 -0800

    Add tests for legendre_phi
---
 t/19-moebius.t | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/t/19-moebius.t b/t/19-moebius.t
index e63ca5c..6287411 100644
--- a/t/19-moebius.t
+++ b/t/19-moebius.t
@@ -6,7 +6,7 @@ use Test::More;
 use Math::Prime::Util
    qw/moebius mertens euler_phi jordan_totient divisor_sum exp_mangoldt
       chebyshev_theta chebyshev_psi carmichael_lambda znorder liouville
-      znprimroot kronecker
+      znprimroot kronecker legendre_phi
      /;
 
 my $extra = defined $ENV{EXTENDED_TESTING} && $ENV{EXTENDED_TESTING};
@@ -255,6 +255,23 @@ if ($use64) {
   push @kroneckers, [-5694706465843977004,9365273357682496999,-1];
 }
 
+my @legendre_sums = (
+  [ 89, 4, 21 ],
+  [ 46, 4, 11 ],
+  [ 47, 4, 12 ],
+  [ 48, 4, 12 ],
+  [ 52, 4, 12 ],
+  [ 53, 4, 13 ],
+  [10000, 5, 2077],
+  [526, 7, 95],
+  [588, 6, 111],
+  [100000, 5, 20779],
+  [5882, 6, 1128],
+  [100000, 7, 18053],
+  [10000, 8, 1711],
+  [1000000, 168, 78331],
+);
+
 # These are slow with XS, and *really* slow with PP.
 if (!$usexs) {
   %big_mertens = map { $_ => $big_mertens{$_} }
@@ -283,6 +300,7 @@ plan tests => 0 + 1
                 + 1 # Small Carmichael Lambda
                 + scalar(@kroneckers)
                 + scalar(@mult_orders)
+                + scalar(@legendre_sums)
                 + scalar(keys %primroots) + 2
                 + scalar(keys %jordan_totients)
                 + 2  # Dedekind psi calculated two ways
@@ -449,6 +467,11 @@ foreach my $i (@liouville_pos) {
 foreach my $i (@liouville_neg) {
   is( liouville($i), -1, "liouville($i) = -1" );
 }
+###### Legendre phi
+foreach my $r (@legendre_sums) {
+  my($x, $a, $exp) = @$r;
+  is( legendre_phi($x, $a), $exp, "legendre_phi($x,$a) = $exp" );
+}
 
 sub cmp_closeto {
   my $got = shift;

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