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 a193d10d6fc15bb04a6513f542f8e2c7bb1e6517 Author: Dana Jacobsen <[email protected]> Date: Sat Dec 28 14:15:23 2013 -0800 Make sure PP znprimroot handles non-cyclic nputs quickly --- lib/Math/Prime/Util.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm index 64de45b..fa11fa9 100644 --- a/lib/Math/Prime/Util.pm +++ b/lib/Math/Prime/Util.pm @@ -1723,10 +1723,15 @@ 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 $n-1 if $n <= 4; + if ($n <= 4) { + return if $n == 0; + return $n-1; + } + return if $n % 4 == 0; my $a = 1; my $phi = euler_phi($n); + # Check that a primitive root exists. + return if !is_prob_prime($n) && $phi != carmichael_lambda($n); my @exp = map { int($phi/$_->[0]) } factor_exp($phi); #print "phi: $phi factors: ", join(",",factor($phi)), "\n"; #print " exponents: ", join(",", @exp), "\n"; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
