Riordan numbers: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (New draft task and Raku entry) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: typos, extend stretch) |
||
Line 15: | Line 15: | ||
;Stretch |
;Stretch |
||
* Find and display the '''digit count''' of the |
* Find and display the '''digit count''' of the 1,000th Riordan number. |
||
* Find and display the '''digit count''' of the 10,000th Riordan number. |
|||
Line 30: | Line 31: | ||
my $upto = 32; |
my $upto = 32; |
||
say "First {$upto.&cardinal} Riordan numbers:\n" ~ @riordan[^$upto]».&comma».fmt("%17s").batch(4).join("\n") ~ "\n"; |
say "First {$upto.&cardinal} Riordan numbers:\n" ~ @riordan[^$upto]».&comma».fmt("%17s").batch(4).join("\n") ~ "\n"; |
||
say "The 1000th has {@riordan[9999].chars} digits"; |
|||
sub abr ($_) { .chars < 41 ?? $_ !! .substr(0,20) ~ '..' ~ .substr(*-20) ~ " ({.chars} digits)" } |
|||
</lang> |
|||
say "The {.Int.&ordinal}: " ~ abr @riordan[$_ - 1] for 1e3, 1e4</lang> |
|||
{{out}} |
{{out}} |
||
<pre>First thirty-two Riordan numbers: |
<pre>First thirty-two Riordan numbers: |
||
Line 43: | Line 46: | ||
54,022,715,451 154,000,562,758 439,742,222,071 1,257,643,249,140 |
54,022,715,451 154,000,562,758 439,742,222,071 1,257,643,249,140 |
||
The one thousandth: 51077756867821111314..79942013897484633052 (472 digits) |
|||
The 1000th has 4765 digits</pre> |
|||
The ten thousandth: 19927418577260688844..71395322020211157137 (4765 digits)</pre> |