[libmath-prime-util-perl] 53/181: Fix PP test issues

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:51:06 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 08a2f59d1829e17c67946bbebe0553579340ecef
Author: Dana Jacobsen <dana at acm.org>
Date:   Sat Dec 28 01:46:50 2013 -0800

    Fix PP test issues
---
 lib/Math/Prime/Util.pm    |  5 +++--
 lib/Math/Prime/Util/PP.pm | 17 +++++++++++++++++
 util.c                    |  2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 4fb7262..e3d9468 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1721,8 +1721,9 @@ sub _generic_znorder {
 
 sub _generic_znprimroot {
   my($n) = @_;
+  $n = -$n if defined $n && $n =~ /^-\d+/;   # TODO: fix this for string bigints
   _validate_num($n) || _validate_positive_integer($n);
-  return if $n <= 0;
+  return if $n == 0;
   return $n-1 if $n <= 4;
   my $a = 1;
   my $phi = euler_phi($n);
@@ -2570,7 +2571,7 @@ __END__
 
 =encoding utf8
 
-=for stopwords forprimes forcomposites fordivisors Möbius Deléglise totient moebius mertens liouville znorder irand primesieve uniqued k-tuples von SoE pari yafu fonction qui compte le nombre nombres voor PhD superset sqrt(N) gcd(A^M k-th (10001st primegen libtommath
+=for stopwords forprimes forcomposites fordivisors Möbius Deléglise totient moebius mertens liouville znorder irand primesieve uniqued k-tuples von SoE pari yafu fonction qui compte le nombre nombres voor PhD superset sqrt(N) gcd(A^M k-th (10001st primegen libtommath kronecker znprimroot
 
 
 =head1 NAME
diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index 9911658..f116c35 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -2764,6 +2764,23 @@ The following conditions must hold:
   - C<< k >= 0 >>
   - C<< n >= 2 >>
 
+=head2 kronecker
+
+Returns the Kronecker symbol C<(a|n)> for two integers.  The possible
+return values with their meanings for odd positive C<n> are:
+
+   0   a = 0 mod n
+   1   a is a quadratic residue modulo n (a = x^2 mod n for some x)
+  -1   a is a quadratic non-residue modulo n
+
+and the return value is congruent to C<a^((n-1)/2)>.  The Kronecker
+symbol is an extension of the Jacobi symbol to all integer values of
+C<n> from its domain of positive odd values of C<n>.  The Jacobi
+symbol is itself an extension of the Legendre symbol, which is
+only defined for odd prime values of C<n>.  This corresponds to Pari's
+C<kronecker(a,n)> function and Mathematica's C<KroneckerSymbol[n,m]>
+function.
+
 
 =head1 UTILITY FUNCTIONS
 
diff --git a/util.c b/util.c
index 9032028..d2c18e7 100644
--- a/util.c
+++ b/util.c
@@ -1008,7 +1008,7 @@ UV znorder(UV a, UV n) {
   }
   return k;
 }
-  
+
 UV znprimroot(UV n) {
   UV fac[MPU_MAX_FACTORS+1];
   UV exp[MPU_MAX_FACTORS+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