Riordan numbers: Difference between revisions

Content added Content deleted
(added Arturo)
Line 685: Line 685:
100000th: 5156659846 .. 4709713332 (47704 digits)
100000th: 5156659846 .. 4709713332 (47704 digits)
</pre>
</pre>

=={{header|Julia}}==
{{trans|Python}}
<syntaxhighlight lang="julia">""" julia example for rosettacode.org/wiki/Riordan_number """

using Formatting

const riordans = zeros(BigInt, 10000)
riordans[begin] = 1

for i in firstindex(riordans)+1:lastindex(riordans)-1
riordans[i + 1] = (i - 1) * (2 * riordans[i] + 3 * riordans[i - 1]) ÷ (i + 1)
end

for i in 0:31
print(rpad(format(riordans[begin+i], commas = true), 18), (i + 1) % 4 == 0 ? "\n" : "")
end
println("\nThe 1,000th Riordan has $(length(string(riordans[1000]))) digits.")
println("The 10,000th Riordan has $(length(string(riordans[10_000]))) digits.")
</syntaxhighlight>{{out}}
<pre>
1 0 1 1
3 6 15 36
91 232 603 1,585
4,213 11,298 30,537 83,097
227,475 625,992 1,730,787 4,805,595
13,393,689 37,458,330 105,089,229 295,673,994
834,086,421 2,358,641,376 6,684,761,125 18,985,057,351
54,022,715,451 154,000,562,758 439,742,222,071 1,257,643,249,140

The 1,000th Riordan has 472 digits.
The 10,000th Riordan has 4765 digits.
</pre>



=={{header|Perl}}==
=={{header|Perl}}==