math.combinatorics: faster nCk (use integer division).

db4
John Benediktsson 2013-04-06 11:43:20 -07:00
parent a52ee59005
commit d15dbaebb4
1 changed files with 2 additions and 1 deletions

View File

@ -24,7 +24,7 @@ MEMO: factorial ( n -- n! )
2dup possible? [ dupd - [a,b) product ] [ 2drop 0 ] if ;
: nCk ( n k -- nCk )
twiddle [ nPk ] keep factorial / ;
twiddle [ nPk ] keep factorial /i ;
! Factoradic-based permutation methodology
@ -112,6 +112,7 @@ PRIVATE>
: next-permutation ( seq -- seq )
dup [ ] [ drop (next-permutation) ] if-empty ;
! Combinadic-based combination methodology
<PRIVATE