Summarize primes: Difference between revisions
Content deleted Content added
Thundergnat (talk | contribs) m →{{header|Raku}}: commas and count |
|||
Line 82:
=={{header|Raku}}==
<lang perl6>
my @primesums = ([\+] grep *.is-prime, ^Inf)[^1000];
printf "The sum of the first %*d is prime: %d\n", @primesums.end.chars, 1 + $_, @primesums[$_]▼
say "Of the
.map( -> $p {
sprintf "The sum of the first %*d is prime: %s",
▲
}
).join("\n")
given grep { @primesums[$_].is-prime }, ^+@primesums;</lang>
{{out}}
<pre>Of the first 1000 primes: 76 cumulative prime sums:
The sum of the first 1 is prime: 2
The sum of the first 2 is prime: 5
Line 94 ⟶ 100:
The sum of the first 12 is prime: 197
The sum of the first 14 is prime: 281
The sum of the first 60 is prime:
The sum of the first 64 is prime:
The sum of the first 96 is prime:
The sum of the first 100 is prime:
The sum of the first 102 is prime:
The sum of the first 108 is prime:
The sum of the first 114 is prime:
The sum of the first 122 is prime:
The sum of the first 124 is prime:
The sum of the first 130 is prime:
The sum of the first 132 is prime:
The sum of the first 146 is prime:
The sum of the first 152 is prime:
The sum of the first 158 is prime:
The sum of the first 162 is prime:
The sum of the first 178 is prime:
The sum of the first 192 is prime:
The sum of the first 198 is prime:
The sum of the first 204 is prime:
The sum of the first 206 is prime:
The sum of the first 208 is prime:
The sum of the first 214 is prime:
The sum of the first 216 is prime:
The sum of the first 296 is prime:
The sum of the first 308 is prime:
The sum of the first 326 is prime:
The sum of the first 328 is prime:
The sum of the first 330 is prime:
The sum of the first 332 is prime:
The sum of the first 334 is prime:
The sum of the first 342 is prime:
The sum of the first 350 is prime:
The sum of the first 356 is prime:
The sum of the first 358 is prime:
The sum of the first 426 is prime:
The sum of the first 446 is prime:
The sum of the first 458 is prime:
The sum of the first 460 is prime:
The sum of the first 464 is prime:
The sum of the first 480 is prime:
The sum of the first 484 is prime:
The sum of the first 488 is prime:
The sum of the first 512 is prime:
The sum of the first 530 is prime:
The sum of the first 536 is prime:
The sum of the first 548 is prime:
The sum of the first 568 is prime:
The sum of the first 620 is prime:
The sum of the first 630 is prime:
The sum of the first 676 is prime:
The sum of the first 680 is prime:
The sum of the first 696 is prime:
The sum of the first 708 is prime:
The sum of the first 734 is prime:
The sum of the first 762 is prime:
The sum of the first 768 is prime:
The sum of the first 776 is prime:
The sum of the first 780 is prime:
The sum of the first 784 is prime:
The sum of the first 808 is prime:
The sum of the first 814 is prime:
The sum of the first 820 is prime:
The sum of the first 836 is prime:
The sum of the first 844 is prime:
The sum of the first 848 is prime:
The sum of the first 852 is prime:
The sum of the first 926 is prime:
The sum of the first 942 is prime:
The sum of the first 984 is prime:
The sum of the first 992 is prime:
=={{header|Ring}}==
|