[libmath-prime-util-perl] 09/35: Add tests for liouville function

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


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

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

commit f8f9827fa614393b2468b77a76db15d1f0ed88ac
Author: Dana Jacobsen <dana at acm.org>
Date:   Mon Oct 21 16:46:20 2013 -0700

    Add tests for liouville function
---
 TODO           |  2 +-
 t/19-moebius.t | 24 ++++++++++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO
index 54888ee..83e148c 100644
--- a/TODO
+++ b/TODO
@@ -57,4 +57,4 @@
   algorithm).  The PP code isn't doing that, which means we're doing lots of
   extra primality checks, which aren't cheap in PP.
 
-- tests for factor_exp, liouville.
+- tests for factor_exp.
diff --git a/t/19-moebius.t b/t/19-moebius.t
index 19011c5..b5b5160 100644
--- a/t/19-moebius.t
+++ b/t/19-moebius.t
@@ -5,7 +5,7 @@ use warnings;
 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/;
+      chebyshev_theta chebyshev_psi carmichael_lambda znorder liouville/;
 
 my $extra = defined $ENV{EXTENDED_TESTING} && $ENV{EXTENDED_TESTING};
 my $use64 = Math::Prime::Util::prime_get_config->{'maxbits'} > 32;
@@ -190,6 +190,18 @@ if (!$usexs) {
                  keys %big_mertens;
 }
 
+my @liouville_pos = (qw/24 51 94 183 294 629 1488 3684 8006 8510 32539 57240
+   103138 238565 444456 820134 1185666 3960407 4429677 13719505 29191963
+   57736144 134185856 262306569 324235872 563441153 1686170713 2489885844/);
+my @liouville_neg = (qw/23 47 113 163 378 942 1669 2808 8029 9819 23863 39712
+   87352 210421 363671 562894 1839723 3504755 7456642 14807115 22469612
+   49080461 132842464 146060791 279256445 802149183 1243577750 3639860654/);
+if ($use64) {
+  push @liouville_pos, (qw/1260238066729040 10095256575169232896/);
+  push @liouville_neg, (qw/1807253903626380 12063177829788352512/);
+}
+
+
 plan tests => 0 + 1
                 + 1 # Small Moebius
                 + 3*scalar(keys %mertens)
@@ -205,7 +217,8 @@ plan tests => 0 + 1
                 + 1 + 2*scalar(keys %sigmak) + 2
                 + scalar(keys %mangoldt)
                 + scalar(keys %chebyshev1)
-                + scalar(keys %chebyshev2);
+                + scalar(keys %chebyshev2)
+                + scalar(@liouville_pos) + scalar(@liouville_neg);
 
 ok(!eval { moebius(0); }, "moebius(0)");
 
@@ -335,6 +348,13 @@ foreach my $moarg (@mult_orders) {
   my $zn = znorder($a, $n);
   is( $zn, $exp, "znorder($a, $n) = " . ((defined $exp) ? $exp : "<undef>") );
 }
+###### liouville
+foreach my $i (@liouville_pos) {
+  is( liouville($i),  1, "liouville($i) = 1" );
+}
+foreach my $i (@liouville_neg) {
+  is( liouville($i), -1, "liouville($i) = -1" );
+}
 
 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