Extra primes: Difference between revisions

→‎{{header|Perl}}: updated code to also check the sum of digits
(→‎{{header|Perl}}: updated code to also check the sum of digits)
Line 1,676:
use warnings;
use feature 'say';
use ntheory 'qw(is_prime' vecsum todigits forprimes);
 
my $nstr;
forprimes {
is_prime(vecsum(todigits($_))) and /^[2357]+$/ and $nstr .= sprintf '%-5d', $_ for 1..10000;
say $n =~ s/.{1,80}\K /\n/gr;</lang>
} 1e4;
say $nstr =~ s/.{1,80}\K /\n/gr;</lang>
{{out}}
<pre>
<pre>2 3 5 7 23 37223 227 53 337 73353 373 223 557 227 577 233 733 257 757 277 773 337 353 3732333
523 557 577 727 733 757 773 2237 2273 2333 2357 2377 2557 2753 2777 3253
32572357 33232377 33732557 35272753 35332777 35573253 37273257 37333323 52273527 3727 5233 5237 5273 5323 5333 5527 55577237
5573 5737 7237 7253 7333 7523 7537 7573 7577 7723 7727 7753 7757</pre>
</pre>
 
=={{header|Phix}}==
2,747

edits