Smarandache prime-digital sequence: Difference between revisions

Content added Content deleted
m (→‎{{header|zkl}}: add result)
(→‎{{header|Perl 6}}: Well, if everybody else is going overboard, I may as well too.)
Line 163: Line 163:
=={{header|Perl 6}}==
=={{header|Perl 6}}==


<lang perl6># Implemented as a lazy, extendable list
<lang perl6>use Lingua::EN::Numbers::Cardinal;
sub comma { $^i.flip.comb(3).join(',').flip }


# Implemented as a lazy, extendable list
my $spds = flat 2,3,5,7, (1..*).map: { grep { .is-prime }, [X~] |((2,3,5,7) xx $_), (3,7) };
my $spds = flat 2,3,5,7, (1..*).map: { grep { .is-prime }, [X~] |((2,3,5,7) xx $_), (3,7) };


say 'Smarandache prime-digitals:';
say 'Smarandache prime-digitals:';
printf "%15s: %s\n", ordinal(1+$_).tclc, comma $spds[$_] for flat ^25, 99, 999, 9999;</lang>

printf "%4d: %s\n", 1+$_, $spds[$_] for flat ^25, 99;</lang>
{{out}}
{{out}}
<pre>Smarandache prime-digitals:
<pre>Smarandache prime-digitals:
1: 2
First: 2
2: 3
Second: 3
3: 5
Third: 5
4: 7
Fourth: 7
5: 23
Fifth: 23
6: 37
Sixth: 37
7: 53
Seventh: 53
8: 73
Eighth: 73
9: 223
Ninth: 223
10: 227
Tenth: 227
11: 233
Eleventh: 233
12: 257
Twelfth: 257
13: 277
Thirteenth: 277
14: 337
Fourteenth: 337
15: 353
Fifteenth: 353
16: 373
Sixteenth: 373
17: 523
Seventeenth: 523
18: 557
Eighteenth: 557
19: 577
Nineteenth: 577
20: 727
Twentieth: 727
21: 733
Twenty-first: 733
22: 757
Twenty-second: 757
23: 773
Twenty-third: 773
Twenty-fourth: 2,237
24: 2237
Twenty-fifth: 2,273
25: 2273
One hundredth: 33,223
100: 33223</pre>
One thousandth: 3,273,527
Ten thousandth: 273,322,727</pre>


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