[libmath-prime-util-perl] 08/55: Add PythagoreanHypots to numseqs example

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


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

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

commit 7996de204d00bdf7ad247393251e0def7eeb3ab6
Author: Dana Jacobsen <dana at acm.org>
Date:   Mon Apr 28 17:20:59 2014 -0700

    Add PythagoreanHypots to numseqs example
---
 examples/numseqs.pl | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/examples/numseqs.pl b/examples/numseqs.pl
index a35d731..23ace8f 100755
--- a/examples/numseqs.pl
+++ b/examples/numseqs.pl
@@ -215,6 +215,20 @@ if      ($type eq 'Abundant') {
   }
 } elsif ($type eq 'Primorials') {
   print join " ", map { pn_primorial($_) } 0..$count-1;
+} elsif ($type eq 'PythagoreanHypots') {
+  my $i = 2;
+  if ($arg eq 'primitive') {
+    while (@n < $count) {
+      $i++ while scalar grep { 0 != ($_-1) % 4 } factor($i);
+      push @n, $i++;
+    }
+  } else {
+    while (@n < $count) {
+      $i++ while !scalar grep { 0 == ($_-1) % 4 } factor($i);
+      push @n, $i++;
+    }
+  }
+  print join " ", @n;
 } elsif ($type eq 'SophieGermainPrimes') {
   my $estimate = sg_upper_bound($count);
   my $numfound = 0;
@@ -309,12 +323,11 @@ if      ($type eq 'Abundant') {
 # Odd
 # Palindromes
 # Perrin
-# PisanoPeriod
+# PisanoPeriod                 MNS uses factoring
 # PisanoPeriodSteps
 # Polygonal
 # Pronic
 # ProthNumbers
-# PythagoranHypots
 # RadixConversion
 # RadixWithoutDigit
 # ReReplace

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