In mathematics, the factorial> of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example:5! = 1 x 2 x 3 x4 x5 = 120. Factorials are used in combinatory. For example, there are n!different ways of arranging distinct objects in a sequence. The arrangements are called permutations. Factorials are also used extensively in probability theory and are often used as a simple example when teaching recursion in computer science. Recursion in computer science is a way of thinking about and solving problems. It is, in fact, one of the central ideas of computer science.