Smarandache-Wellin primes: Difference between revisions

m
→‎{{header|Perl}}: display as ordinals
(Added Perl)
m (→‎{{header|Perl}}: display as ordinals)
Line 507:
use warnings;
use ntheory <is_prime next_prime>;
use Lingua::EN::Numbers::Ordinate 'ordinate';
 
sub abbr ($d) { my $l = length $d; $l < 41 ? $d : substr($d,0,20) . '..' . substr($d,-20) . " ($l digits)" }
Line 516 ⟶ 517:
$n .= $p;
$i++;
(printf("++$nth and push @res, sprintf("%s: Index:%5d Last prime:%6d S-W: %s\n", ordinate $nth, $i, $p, abbr $n) and $nth++) if is_prime( $n);
} until $nth == 8;
</syntaxhighlight>
Line 522 ⟶ 523:
<pre>
Smarandache-Wellen primes:
11st: Index: 0 Last prime: 2 S-W: 2
22nd: Index: 1 Last prime: 3 S-W: 23
33rd: Index: 3 Last prime: 7 S-W: 2357
44th: Index: 127 Last prime: 719 S-W: 23571113171923293137..73677683691701709719 (355 digits)
55th: Index: 173 Last prime: 1033 S-W: 23571113171923293137..10131019102110311033 (499 digits)
66th: Index: 341 Last prime: 2297 S-W: 23571113171923293137..22732281228722932297 (1171 digits)
77th: Index: 434 Last prime: 3037 S-W: 23571113171923293137..30013011301930233037 (1543 digits)
88th: Index: 1428 Last prime: 11927 S-W: 23571113171923293137..11903119091192311927 (5719 digits)
</pre>
 
2,392

edits