Muchof the mathematics of the factorial function was developed beginning in the late 18th and early 19th centuries.Stirling's approximation provides an accurate approximation to the factorial of large numbers, showing that it grows more quickly than exponential growth. Legendre's formula describes the exponents of the prime numbers in a prime factorization of the factorials, and can be used to count the trailing zeros of the factorials. Daniel Bernoulli and Leonhard Euler interpolated the factorial function to a continuous function of complex numbers, except at the negative integers, the (offset) gamma function.
Many other notable functions and number sequences are closely related to the factorials, including the binomial coefficients, double factorials, falling factorials, primorials, and subfactorials. Implementations of the factorial function are commonly used as an example of different computer programming styles, and are included in scientific calculators and scientific computing software libraries. Although directly computing large factorials using the product formula or recurrence is not efficient, faster algorithms are known, matching to within a constant factor the time for fast multiplication algorithms for numbers with the same number of digits.
From the late 15th century onward, factorials became the subject of study by Western mathematicians. In a 1494 treatise, Italian mathematician Luca Pacioli calculated factorials up to 11!, in connection with a problem of dining table arrangements.[12] Christopher Clavius discussed factorials in a 1603 commentary on the work of Johannes de Sacrobosco, and in the 1640s, French polymath Marin Mersenne published large (but not entirely correct) tables of factorials, up to 64!, based on the work of Clavius.[13] The power series for the exponential function, with the reciprocals of factorials for its coefficients, was first formulated in 1676 by Isaac Newton in a letter to Gottfried Wilhelm Leibniz.[14] Other important works of early European mathematics on factorials include extensive coverage in a 1685 treatise by John Wallis, a study of their approximate values for large values of n \displaystyle n by Abraham de Moivre in 1721, a 1729 letter from James Stirling to de Moivre stating what became known as Stirling's approximation, and work at the same time by Daniel Bernoulli and Leonhard Euler formulating the continuous extension of the factorial function to the gamma function.[15] Adrien-Marie Legendre included Legendre's formula, describing the exponents in the factorization of factorials into prime powers, in an 1808 text on number theory.[16]
The notation n ! \displaystyle n! for factorials was introduced by the French mathematician Christian Kramp in 1808.[17] Many other notations have also been used. Another later notation n _ \displaystyle \vert \!\underline \,n , in which the argument of the factorial was half-enclosed by the left and bottom sides of a box, was popular for some time in Britain and America but fell out of use, perhaps because it is difficult to typeset.[17] The word "factorial" (originally French: factorielle) was first used in 1800 by Louis Franois Antoine Arbogast,[18] in the first work on Fa di Bruno's formula,[19] but referring to a more general concept of products of arithmetic progressions. The "factors" that this name refers to are the terms of the product formula for the factorial.[20]
The special case of Legendre's formula for p = 5 \displaystyle p=5 gives the number of trailing zeros in the decimal representation of the factorials.[57] According to this formula, the number of zeros can be obtained by subtracting the base-5 digits of n \displaystyle n from n \displaystyle n , and dividing the result by four.[58] Legendre's formula implies that the exponent of the prime p = 2 \displaystyle p=2 is always larger than the exponent for p = 5 \displaystyle p=5 , so each factor of five can be paired with a factor of two to produce one of these trailing zeros.[57] The leading digits of the factorials are distributed according to Benford's law.[59] Every sequence of digits, in any base, is the sequence of initial digits of some factorial number in that base.[60]
Other complex functions that interpolate the factorial values include Hadamard's gamma function, which is an entire function over all the complex numbers, including the non-positive integers.[69][70] In the p-adic numbers, it is not possible to continuously interpolate the factorial function directly, because the factorials of large integers (a dense subset of the p-adics) converge to zero according to Legendre's formula, forcing any continuous function that is close to their values to be zero everywhere. Instead, the p-adic gamma function provides a continuous interpolation of a modified form of the factorial, omitting the factors in the factorial that are divisible by p.[71]
The factorial function is a common feature in scientific calculators.[73] It is also included in scientific programming libraries such as the Python mathematical functions module[74] and the Boost C++ library.[75] If efficiency is not a concern, computing factorials is trivial: just successively multiply a variable initialized to 1 \displaystyle 1 by the integers up to n \displaystyle n . The simplicity of this computation makes it a common example in the use of different computer programming styles and methods.[76]
Other methods suitable for its computation include memoization,[79] dynamic programming,[80] and functional programming.[81] The computational complexity of these algorithms may be analyzed using the unit-cost random-access machine model of computation, in which each arithmetic operation takes constant time and each number uses a constant amount of storage space. In this model, these methods can compute n ! \displaystyle n! in time O ( n ) \displaystyle O(n) , and the iterative version uses space O ( 1 ) \displaystyle O(1) . Unless optimized for tail recursion, the recursive version takes linear space to store its call stack.[82] However, this model of computation is only suitable when n \displaystyle n is small enough to allow n ! \displaystyle n! to fit into a machine word.[83] The values 12! and 20! are the largest factorials that can be stored in, respectively, the 32-bit[84] and 64-bit integers.[85] Floating point can represent larger factorials, but approximately rather than exactly, and will still overflow for factorials larger than 170 ! \displaystyle 170! .[84]
Even better efficiency is obtained by computing n! from its prime factorization, based on the principle that exponentiation by squaring is faster than expanding an exponent into a product.[86][89] An algorithm for this by Arnold Schnhage begins by finding the list of the primes up to n \displaystyle n , for instance using the sieve of Eratosthenes, and uses Legendre's formula to compute the exponent for each prime. Then it computes the product of the prime powers with these exponents, using a recursive algorithm, as follows:
The Factorial of a whole number 'n' is defined as the product of that number with every whole number less than or equal to 'n' till 1. For example, the factorial of 4 is 4 3 2 1, which is equal to 24. It is represented using the symbol '!' So, 24 is the value of 4!. The study of factorials is at the root of several topics in mathematics, such as number theory, algebra, geometry, probability, statistics, graph theory, discrete mathematics, etc.
In the year 1677, Fabian Stedman, a British author, defined factorial as an equivalent of change ringing. Change ringing was a part of the musical performance where the musicians would ring multiple tuned bells. In the year 1808, when a mathematician from France, Christian Kramp, came up with the symbol for factorial: n!. Thinking about how to calculate the factorial of a number? Let's learn.
The factorial of a whole number is the function that multiplies the number by every natural number below it. Symbolically, a factorial can be represented by using the symbol "!". This symbol lies on the same key above "1" on a computer keyboard. "n factorial" is the product of the first n natural numbers and is represented as n!
Factorial in math is one of the operations (denoted by the symbol "!") and the factorial of a number is the product of the number with all positive integers less than that number. Here are some examples of factorial of numbers.
Factorial is a function that is used to find the number of possible ways in which a selected number of objects can be arranged among themselves. This concept of factorial is used for finding permutations and combinations of numbers and events.
Factorial in math is one of the operations (denoted by the symbol \"!\") and the factorial of a number is the product of the number with all positive integers less than that number. Here are some examples of factorial of numbers.
In the other thread, I mentioned the discussion in the Usenet newsgroup sci.math in January-February, Subject: Number of digits in factorial. Although neither proof nor counterexample was found, I'd recommend looking over that discussion before starting in on this question.
Kamenetsky was right to suggest that the approximation should fail sometimes: in base 10, we expect $n$ to be a counterexample with probability about $1/cn$ with $c = 12 \log 10$, so on average each range $[N, 10^12N]$ should have about one. Thus it is not surprising that the first one (past $n=1!$) turns out to have $13$ digits. This heuristic is also the source of the estimate $1-\exp(-\frac16)$ for the probability of another counterexample in $ [10^13, 10^15]$.
While I'm at it: I should have mentioned that the gp/pari computation also found (in a minute or two) all the terms in $[10^4,10^8]$ listed by OEIS, which lends the new results some credibility; and I thank Gerry Myerson for drawing my attention to this question with his edit of about two weeks ago.
3a8082e126