Instruction

1

To find the factorial of a number, you need to calculate the product of all the integers in the interval from 1 to a given number. The General formula is as follows:

n! = 1*2*...*n, where n is any nonnegative integer. A factorial is denoted with an exclamation mark.

n! = 1*2*...*n, where n is any nonnegative integer. A factorial is denoted with an exclamation mark.

2

The basic properties of factorials:

• 0! = 1;

• n! = n*(n-1)! ;

• n!^2 ≥ n^n ≥ n! ≥ n.

The second property of the factorial is called recursion and the factorial – elementary recursive function. Recursive functions are often used in the theory of algorithms and writing computer programs, since many algorithms, and programming functions have a recursive structure.

• 0! = 1;

• n! = n*(n-1)! ;

• n!^2 ≥ n^n ≥ n! ≥ n.

The second property of the factorial is called recursion and the factorial – elementary recursive function. Recursive functions are often used in the theory of algorithms and writing computer programs, since many algorithms, and programming functions have a recursive structure.

3

To determine the factorial of a large number by the Stirling formula, which gives, however, approximate equality, but with a little error. Full formula is as follows:

n! = (n/e)^n*√(2*π*n)*(1 + 1/(12*n) + 1/(288*n^2) + ...)

ln (n!) = (n + 1/2)*ln n – n + ln √(2*π),

where e is the base of natural logarithm, Euler's number, whose numerical value is made approximately equal 2,71828...; π – mathematical constant whose value was equal to 3.14.

Widespread use of the Stirling formula in the form:

n! ≈ √(2*π*n)*(n/e)^n.

n! = (n/e)^n*√(2*π*n)*(1 + 1/(12*n) + 1/(288*n^2) + ...)

ln (n!) = (n + 1/2)*ln n – n + ln √(2*π),

where e is the base of natural logarithm, Euler's number, whose numerical value is made approximately equal 2,71828...; π – mathematical constant whose value was equal to 3.14.

Widespread use of the Stirling formula in the form:

n! ≈ √(2*π*n)*(n/e)^n.

4

There are various generalizations of the notion of factorial, for example, double -, m-fold, decreasing, increasing, primorial, superfactory. The double factorial is denoted by !! and is the product of all natural numbers in the interval from 1 to the number having the same parity, for example, 6!! = 2*4*6.

5

m-fold factorial General case of the double factorial for any integer non-negative numbers m:

for n = mk – r true n!...!! = ∏ (m*I - r), where r is the set of integers from 0 to m-1, I – belongs to the set of integers from 1 to k.

for n = mk – r true n!...!! = ∏ (m*I - r), where r is the set of integers from 0 to m-1, I – belongs to the set of integers from 1 to k.

6

Decreasing factorial is written as follows:

(n)_k = n!/(n - k)!

Growing:

(n)^k = (n + k -1)!/(n - 1)!

(n)_k = n!/(n - k)!

Growing:

(n)^k = (n + k -1)!/(n - 1)!

7

Primorial number equal to the product of primes less than the number and is denoted by #, for example:

12# = 2*3*5*7*11, obviously, 13# = 11# = 12#.

Superbacteria equal to the product of the factorials of the integers in the interval from 1 to the original number, i.e.:

sf(n) = 1!*2!*3*...(n - 1)!*n! for example, sf(3) = 1!*2!*3! = 1*1*2*1*2*3 = 12.

12# = 2*3*5*7*11, obviously, 13# = 11# = 12#.

Superbacteria equal to the product of the factorials of the integers in the interval from 1 to the original number, i.e.:

sf(n) = 1!*2!*3*...(n - 1)!*n! for example, sf(3) = 1!*2!*3! = 1*1*2*1*2*3 = 12.