Riordan numbers: Difference between revisions
Content added Content deleted
(Added Action! and Algol W) |
(Riordan numbers in FreeBASIC) |
||
Line 294: | Line 294: | ||
r[9999] has 4765 digits |
r[9999] has 4765 digits |
||
</pre> |
</pre> |
||
=={{header|FreeBASIC}}== |
|||
<syntaxhighlight lang="freebasic">Const limit = 31 |
|||
Sub Riordan (n As Integer, a() As Integer) |
|||
If n >= 0 Then |
|||
a(0) = 1 |
|||
If n >= 1 Then |
|||
a(1) = 0 |
|||
For i As Integer = 2 To n |
|||
a(i) = ((i-1) * ((2 * a(i-1)) + (3 * a(i-2)))) / (i+1) |
|||
Next i |
|||
End If |
|||
End If |
|||
End Sub |
|||
Dim As Integer r(0 To limit) |
|||
Dim As Byte cont = 0 |
|||
Print "First 32 Riordan numbers:" |
|||
Riordan(limit, r()) |
|||
For i As Integer = 0 To limit |
|||
Print Using " #############"; r(i); |
|||
cont += 1 |
|||
If cont Mod 4 = 0 Then Print |
|||
Next i |
|||
Sleep</syntaxhighlight> |
|||
{{out}} |
|||
<pre>First 32 Riordan numbers: |
|||
1 0 1 1 |
|||
3 6 15 36 |
|||
91 232 603 1585 |
|||
4213 11298 30537 83097 |
|||
227475 625992 1730787 4805595 |
|||
13393689 37458330 105089229 295673994 |
|||
834086421 2358641376 6684761125 18985057351 |
|||
54022715451 154000562758 439742222071 1257643249140</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |