Anonymous user
Bell numbers: Difference between revisions
→{{header|REXX}}: added further optimization for the COMB function.
m (→{{header|REXX}}: added whitespace, optimized the FACT function.) |
(→{{header|REXX}}: added further optimization for the COMB function.) |
||
Line 2,045:
commas: parse arg _; do c=length(_)-3 to 1 by -3; _=insert(',', _, c); end; return _
/*──────────────────────────────────────────────────────────────────────────────────────*/
comb: procedure expose !.; parse arg x,y; if x==y
if x-y<y then y= x - y; if !.x.y\==. then return !.x.y / fact(y)
_= 1; do j=x-y+1 to x; _= _
/*──────────────────────────────────────────────────────────────────────────────────────*/
fact: procedure expose !.; parse arg x; if !.x\==. then return !.x; != 1
|