Nice primes: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: elided duplicated output text.)
(→‎{{header|Raku}}: Alternate)
Line 479: Line 479:
659 673 677 691 709 727 743 761 797 821 839
659 673 677 691 709 727 743 761 797 821 839
853 857 887 907 911 929 941 947 977 983 997</pre>
853 857 887 907 911 929 941 947 977 983 997</pre>

Alternately, with somewhat better separation of concerns.
<lang perl6>sub digroot ($r) { ($r, { .comb.sum } … { .chars == 1 }).tail }
sub is-nice ($_) { .is-prime && .&digroot.is-prime }
say (500 ^..^ 1000).grep( *.&is-nice ).batch(11)».fmt("%4d").join: "\n";</lang>
Same output.


=={{header|REXX}}==
=={{header|REXX}}==