This is an automated email from the git hooks/post-receive script. ppm-guest pushed a commit to annotated tag v0.27 in repository libmath-prime-util-perl.
commit 376cab3ef49203b8845547c570a30023e7b1242c Author: Dana Jacobsen <d...@acm.org> Date: Wed May 15 17:00:53 2013 -0700 Let primes.pl accept +N as a second argument --- Changes | 7 +++++++ bin/primes.pl | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 1d24234..3207a94 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,13 @@ Revision history for Perl extension Math::Prime::Util. - is_prob_prime / is_prime about 10% faster for composites. + - Allow '+N' as the second parameter to primes.pl. This allows: + primes.pl 100 +30 + to return the primes between 100 and 130. Or: + primes.pl 'nth_prime(1000000000)' +2**8 + + - Use EXTENDED_TESTING to turn on extra tests. + 0.26 21 April 2013 - Pure Perl factoring: diff --git a/bin/primes.pl b/bin/primes.pl index a34283e..97e4f68 100755 --- a/bin/primes.pl +++ b/bin/primes.pl @@ -71,6 +71,8 @@ $| = 1; # perl -MMath::Prime::Util=is_prime -MMath::NumSeq::Palindromes=:all -E 'my $seq = Math::NumSeq::Palindromes->new; my $v = 0; while (1) { $v = ($seq->next)[1]; last if $v > $end; say $v if is_prime($v); } BEGIN {our $end = 1000000000}' my %opts; +# Make Getopt not capture + +Getopt::Long::Configure(qw/no_getopt_compat/); GetOptions(\%opts, 'safe|A005385', 'sophie|sg|A005384', @@ -101,7 +103,7 @@ GetOptions(\%opts, Math::Prime::Util::prime_set_config(gmp=>0) if exists $opts{'nompugmp'}; if (exists $opts{'version'}) { my $version_str = - "primes.pl version 1.2 using Math::Prime::Util $Math::Prime::Util::VERSION"; + "primes.pl version 1.3 using Math::Prime::Util $Math::Prime::Util::VERSION"; $version_str .= " and MPU::GMP $Math::Prime::Util::GMP::VERSION" if Math::Prime::Util::prime_get_config->{'gmp'}; $version_str .= "\nWritten by Dana Jacobsen.\n"; @@ -113,6 +115,7 @@ die_usage() if exists $opts{'help'}; die_usage() unless @ARGV == 2; my ($start, $end) = @ARGV; # Allow some expression evaluation on the input, but don't just eval it. +$end = "($start)$end" if $end =~ /^\+/; $start = eval_expr($start) unless $start =~ /^\d+$/; $end = eval_expr($end ) unless $end =~ /^\d+$/; die "$start isn't a positive integer" if $start =~ tr/0123456789//c; @@ -593,6 +596,7 @@ Usage: $0 [options] START END Displays all primes between the positive integers START and END, inclusive. The START and END values must be integers or simple expressions. This allows inputs like "10**500+100" or "2**64-1000" or "2 * nth_prime(560)". +Additionally, if END starts with '+' then it is assumed to add to START. General options: -- 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