< Day Day Up > |
Factorial()Category: Number Syntax: Factorial (number { ; numberOfFactors }) Parameters: number ”any expression that resolves to a positive integer; numberOfFactors ”any expression that resolves to a positive integer that represents how many factors to include in the multiplication. Parameters in curly braces {} are optional. Description: Returns the factorial of number , stopping either at 1 or stopping at the optional numberOfFactors . The factorial of a number n is defined as n x( n “1)x( n “2)x( n “3) x1. Factorials are useful in statistics and combinatorics. In mathematics, factorials are usually represented by an exclamation mark. 4! = Factorial (4) = 4 x 3 x 2 x 1 = 24 . Examples: Factorial ( 3 ) Returns 6 , which = 3x2x1. Factorial ( 10 ; 3 ) Returns 720 , which = 10x9x8. Comments: One application of factorials is to determine how many unique ways a set of objects can be ordered. For instance, a set of three objects { A, B, C} can be ordered 3! = 6 ways: { ABC, ACB, BAC, BCA, CAB, CBA}. |
< Day Day Up > |