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

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

commit 16bebc83c4502f0b9c73aa0330d5a7529cdc1000
Author: Dana Jacobsen <d...@acm.org>
Date:   Fri Mar 28 06:32:43 2014 -0700

    Add PP nth_twin_prime
---
 lib/Math/Prime/Util/PP.pm   | 15 +++++++++++++++
 lib/Math/Prime/Util/PPFE.pm |  5 +++++
 2 files changed, 20 insertions(+)

diff --git a/lib/Math/Prime/Util/PP.pm b/lib/Math/Prime/Util/PP.pm
index d2bc825..9e7fd2e 100644
--- a/lib/Math/Prime/Util/PP.pm
+++ b/lib/Math/Prime/Util/PP.pm
@@ -1349,6 +1349,16 @@ sub twin_prime_count {
   $sum;
 }
 
+sub nth_twin_prime {
+  my($n) = @_;
+  my($nth, $p, $p2) = (0, 0, 3);
+  while ($n > 0) {
+    if (($p2-$p) == 2) { $nth = $p; $n--; }
+    ($p, $p2) = ($p2, next_prime($p2));
+  }
+  $nth;
+}
+
 
 #############################################################################
 
@@ -2176,9 +2186,14 @@ sub is_aks_prime {
     $n = Math::BigInt->new("$n") unless ref($n) eq 'Math::BigInt';
   }
 
+  my $_verbose = Math::Prime::Util::prime_get_config()->{'verbose'};
+  print "# aks r = $r  s = $rlimit\n" if $_verbose;
+  local $| = 1 if $_verbose > 1;
   for (my $a = 1; $a <= $rlimit; $a++) {
     return 0 unless _test_anr($a, $n, $r);
+    print "." if $_verbose > 1;
   }
+  print "\n" if $_verbose > 1;
 
   return 1;
 }
diff --git a/lib/Math/Prime/Util/PPFE.pm b/lib/Math/Prime/Util/PPFE.pm
index bda8583..f8d1938 100644
--- a/lib/Math/Prime/Util/PPFE.pm
+++ b/lib/Math/Prime/Util/PPFE.pm
@@ -116,6 +116,11 @@ sub twin_prime_count {
   }
   return Math::Prime::Util::PP::twin_prime_count($low,$high);
 }
+sub nth_twin_prime {
+  my($n) = @_;
+  _validate_positive_integer($n);
+  return Math::Prime::Util::PP::nth_twin_prime($n);
+}
 
 
 sub is_prime {

-- 
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
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to