nPk
Contents: Description, Arguments, Usage, Examples, Sub-Functions, Related Functions, Source Supported Under Version: >1.00
Description Permutations (n-pick-k).
Arguments and Return Values Arguments: Two numeric values (must be scalar) Return Value: The number of permutations possible when choosing k items from a set of n items (order matters) So, to find the number of words with 4 different letters possible from a set of 26 letters, use nPk(26, 4) nPk(n, k) = n!/(n-k)! This function uses nPk(n, k) = n*(n-1)*(n-2)*...*(k+1)*k Returns integer when output is small enough to be correctly expressed as an integer; float otherwise If no arguments are input, nPk() prints its description, as shown below.
Usage Syntax: nPk(n, k) 'n' - a scalar value specifying the number of items in the set 'k' - a scalar value specifying the number of items to pick
Examples dv> nPk() Permutations (n pick k) nPk(n, k) returns the number of ways to arrange n elements picked from a set of k elements (n >= k; order matters) nPk = n!/(n - k)! Does NOT work for arrays, only for 1x1x1 inputs S. Marshall 02-25-2008 0 dv> nPk(26, 4) 358800 dv> nPk(26, 0) 1 dv> nPk(26, -1) Inputs must be positive integers 0 dv> nPk(26, 1//2//3) Inputs must be scalar (1x1x1) 0 |
DavinciWiki Mini-Nav Bar Contents
Contact Developers
All other topics
Recent Library Changes Created On: 02-26-2008 |