Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Summarize-primes/Perl/summarize-primes.pl
Normal file
10
Task/Summarize-primes/Perl/summarize-primes.pl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use ntheory <nth_prime is_prime>;
|
||||
|
||||
my($n, $s, $limit, @sums) = (0, 0, 1000);
|
||||
do {
|
||||
push @sums, sprintf '%3d %8d', $n, $s if is_prime($s += nth_prime ++$n)
|
||||
} until $n >= $limit;
|
||||
|
||||
print "Of the first $limit primes: @{[scalar @sums]} cumulative prime sums:\n", join "\n", @sums;
|
||||
Loading…
Add table
Add a link
Reference in a new issue