Primes with digits in nondecreasing order: Difference between revisions

Content added Content deleted
Line 375: Line 375:
50 non-decreasing primes < 1,000: 2 3 5 7 11 ... 557 569 577 599 677
50 non-decreasing primes < 1,000: 2 3 5 7 11 ... 557 569 577 599 677
</pre>
</pre>

=={{header|Perl}}==
<lang perl>#!/usr/bin/perl

use strict; # https://rosettacode.org/wiki/Primes_with_digits_in_nondecreasing_order
use warnings;

my @primes = grep {
! /(.)(.)(??{$1 > $2 ? '' : '(*FAIL)'})/ and (1 x $_) !~ /^(11+)\1+$/
} 2 .. 999;
print "@primes\n" =~ s/.{50}\K /\n/gr, "\ncount: " . @primes, "\n";</lang>
{{out}}
<pre>
2 3 5 7 11 13 17 19 23 29 37 47 59 67 79 89 113 127
137 139 149 157 167 179 199 223 227 229 233 239 257
269 277 337 347 349 359 367 379 389 449 457 467 479
499 557 569 577 599 677

count: 50
</pre>



=={{header|Raku}}==
=={{header|Raku}}==