RosettaCodeData/Task/Combinations-and-permutations/00-TASK.txt

22 lines
986 B
Plaintext

;Task:
Implement the [[wp:Combination|combination]] &nbsp; <big> (<sup>n</sup>C<sub>k</sub>) </big> &nbsp; and [[wp:Permutation|permutation]] &nbsp; <big> (<sup>n</sup>P<sub>k</sub>) </big> &nbsp; operators in the target language:
:::* <math>^n\operatorname C_k =\binom nk = \frac{n(n-1)\ldots(n-k+1)}{k(k-1)\dots1} </math>
:::* <math>^n\operatorname P_k = n\cdot(n-1)\cdot(n-2)\cdots(n-k+1)</math>
<br>
See the Wikipedia articles for a more detailed description.
'''To test''', generate and print examples of:
* &nbsp; A sample of permutations from 1 to 12 and Combinations from 10 to 60 using exact Integer arithmetic.
* &nbsp; A sample of permutations from 5 to 15000 and Combinations from 100 to 1000 using approximate Floating point arithmetic.<br> This 'floating point' code could be implemented using an approximation, e.g., by calling the [[Gamma function]].
;Related task:
* &nbsp; [[Evaluate binomial coefficients]]
{{Template:Combinations and permutations}}
<br><br>