Summarize primes: Difference between revisions

Content deleted Content added
Thundergnat (talk | contribs)
→‎{{header|Raku}}: Add a Raku example
Thundergnat (talk | contribs)
m →‎{{header|Raku}}: fix off-by-one error
Line 41:
<lang perl6>my @primesums = ([\+] grep *.is-prime, ^Inf)[^1000];
say "Of the first {+@primesums} primes:";
printf "The sum of the first %*d is prime: %d\n", @primesums.end.chars, 1 + $_, @primesums[$_]
for grep { @primesums[$_].is-prime }, ^+@primesums;</lang>
{{out}}
<pre>Of the first 1000 primes:
The sum of the first 01 is prime: 2
The sum of the first 12 is prime: 5
The sum of the first 34 is prime: 17
The sum of the first 56 is prime: 41
The sum of the first 1112 is prime: 197
The sum of the first 1314 is prime: 281
The sum of the first 5960 is prime: 7699
The sum of the first 6364 is prime: 8893
The sum of the first 9596 is prime: 22039
The sum of the first 99100 is prime: 24133
The sum of the first 101102 is prime: 25237
The sum of the first 107108 is prime: 28697
The sum of the first 113114 is prime: 32353
The sum of the first 121122 is prime: 37561
The sum of the first 123124 is prime: 38921
The sum of the first 129130 is prime: 43201
The sum of the first 131132 is prime: 44683
The sum of the first 145146 is prime: 55837
The sum of the first 151152 is prime: 61027
The sum of the first 157158 is prime: 66463
The sum of the first 161162 is prime: 70241
The sum of the first 177178 is prime: 86453
The sum of the first 191192 is prime: 102001
The sum of the first 197198 is prime: 109147
The sum of the first 203204 is prime: 116533
The sum of the first 205206 is prime: 119069
The sum of the first 207208 is prime: 121631
The sum of the first 213214 is prime: 129419
The sum of the first 215216 is prime: 132059
The sum of the first 295296 is prime: 263171
The sum of the first 307308 is prime: 287137
The sum of the first 325326 is prime: 325019
The sum of the first 327328 is prime: 329401
The sum of the first 329330 is prime: 333821
The sum of the first 331332 is prime: 338279
The sum of the first 333334 is prime: 342761
The sum of the first 341342 is prime: 360979
The sum of the first 349350 is prime: 379667
The sum of the first 355356 is prime: 393961
The sum of the first 357358 is prime: 398771
The sum of the first 425426 is prime: 581921
The sum of the first 445446 is prime: 642869
The sum of the first 457458 is prime: 681257
The sum of the first 459460 is prime: 687767
The sum of the first 463464 is prime: 700897
The sum of the first 479480 is prime: 754573
The sum of the first 483484 is prime: 768373
The sum of the first 487488 is prime: 782263
The sum of the first 511512 is prime: 868151
The sum of the first 529530 is prime: 935507
The sum of the first 535536 is prime: 958577
The sum of the first 547548 is prime: 1005551
The sum of the first 567568 is prime: 1086557
The sum of the first 619620 is prime: 1313041
The sum of the first 629630 is prime: 1359329
The sum of the first 675676 is prime: 1583293
The sum of the first 679680 is prime: 1603597
The sum of the first 695696 is prime: 1686239
The sum of the first 707708 is prime: 1749833
The sum of the first 733734 is prime: 1891889
The sum of the first 761762 is prime: 2051167
The sum of the first 767768 is prime: 2086159
The sum of the first 775776 is prime: 2133121
The sum of the first 779780 is prime: 2156813
The sum of the first 783784 is prime: 2180741
The sum of the first 807808 is prime: 2327399
The sum of the first 813814 is prime: 2364833
The sum of the first 819820 is prime: 2402537
The sum of the first 835836 is prime: 2504323
The sum of the first 843844 is prime: 2556187
The sum of the first 847848 is prime: 2582401
The sum of the first 851852 is prime: 2608699
The sum of the first 925926 is prime: 3120833
The sum of the first 941942 is prime: 3238237
The sum of the first 983984 is prime: 3557303
The sum of the first 991992 is prime: 3619807</pre>
 
 
=={{header|Ring}}==