Iccanobif primes: Difference between revisions
m
Adjust output formatting
Thundergnat (talk | contribs) (New draft task and Raku example) |
Thundergnat (talk | contribs) m (Adjust output formatting) |
||
Line 18:
=={{header|Raku}}==
<syntaxhighlight lang="raku" line>sub abbr ($_) { (.chars < 41 ?? $_ !! .substr(0,20) ~ '..' ~ .substr(*-20)) ~ " (digits: {.chars}
say (++$).fmt('%2d') ~ ': ' ~ .&abbr for (lazy (1,1,*+*…*).hyper.grep: {.flip.is-prime})[^25];</syntaxhighlight>
{{out}}
<pre> 1: 2 (digits: 1)
2: 3 (digits: 1)
3: 5 (digits: 1)
4: 13 (digits: 2)
5: 34 (digits: 2)
6: 377 (digits: 3)
7: 1597 (digits: 4)
8: 10946 (digits: 5)
9: 75025 (digits: 5)
10: 121393 (digits: 6)
11: 17167680177565 (digits: 14)
12: 135301852344706746049 (digits: 21)
13: 1672445759041379840132227567949787325 (digits: 37)
14: 3691087032412706639440686994833808526209 (digits: 40)
15: 30464466237021013443..96920321847653300991 (
16: 32913358638779021325..58997476926373114877 (
17: 13165703827079947192..88140676510958522773 (
18: 16750341744683276705..59513167849839163757 (
19: 31953053259600357131..02673823374863309871 (
20: 70520374065886416072..50351192710136172329 (
21: 18441226374242153376..35265089601875102405 (
22: 10281003316385169296..29008393747421011503 (
23: 12365854644134546680..55549639624074581864 (
24: 19372256889969382102..48891873035874310178 (
25: 16425634816734200102..63356734522065615471 (
|