Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Catalan-numbers/PureBasic/catalan-numbers.basic
Normal file
23
Task/Catalan-numbers/PureBasic/catalan-numbers.basic
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
; saving the division for last ensures we divide the largest
|
||||
; numerator by the smallest denominator
|
||||
|
||||
Procedure.q CatalanNumber(n.q)
|
||||
If n<0:ProcedureReturn 0:EndIf
|
||||
If n=0:ProcedureReturn 1:EndIf
|
||||
ProcedureReturn (2*(2*n-1))*CatalanNumber(n-1)/(n+1)
|
||||
EndProcedure
|
||||
|
||||
ls=25
|
||||
rs=12
|
||||
|
||||
a.s=""
|
||||
a.s+LSet(RSet("n",rs),ls)+"CatalanNumber(n)"
|
||||
; cw(a.s)
|
||||
Debug a.s
|
||||
|
||||
For n=0 to 33 ;33 largest correct quad for n
|
||||
a.s=""
|
||||
a.s+LSet(RSet(Str(n),rs),ls)+Str(CatalanNumber(n))
|
||||
; cw(a.s)
|
||||
Debug a.s
|
||||
Next
|
||||
Loading…
Add table
Add a link
Reference in a new issue