Contents
Definition
In Mathematics, factorial is an important function, which is used to find how many ways things can be arranged or the ordered set of numbers. The well known interpolating function of the factorial function was discovered by Daniel Bernoulli. The factorial concept is used in many mathematical concepts such as probability, permutations and combinations, sequences and series, etc. In short, a factorial is a function that multiplies a number by every number below it till 1. For example, the factorial of 3 represents the multiplication of numbers 3, 2, 1, i.e. 3! = 3 × 2 × 1 and is equal to 6. In this article, you will learn the mathematical definition of the factorial, its notation, formula, examples and so on in detail. [1]
Factorial
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! [2]
n! or “n factorial” means: n! = 1 · 2 · 3 · … · n,
where n = Product of the first n positive integers = n(n-1)(n-2)…………………….(3)(2)(1)
Standard Deck of Playing Cards
The arrangement of 52 playing cards offers 52 factorial (52!) permutations. This equals approximately 8.07 x 10⁶⁷, meaning no two shuffles are likely to produce the same order in human history.
Subfactorial
The subfactorial is useful in calculating the number of derangements, i.e., the number of permutations of n objects in which none of them remain in their original position. For instance, one derangement of ABCDEF is BADCFE. (The permutation BADECF is not a derangement of ABCDEF because F remains in the last position.) [4]
The subfactorial (!n) calculates the total number of cases n for objects that have each object’s entry not appear in its original location. The lack of original placement for a set of n objects represents a derangement — a permutation of set elements, where no element appears in its original position. At first glance, the written notation for a subfactorial looks to be an incorrectly written factorial. However, the reversal placement of number and exclamation point serves the purpose of solving for specific statistical scenarios. [3]
Given an integer n, the task is to find the subfactorial of the number represented as !n. The subfactorial of a number is defined using the following formula.
For n = 3, the derangements of {1, 2, 3} needs to be found.
The possible arrangements of the set {1, 2, 3} are: {1, 2, 3} {1, 3, 2} {2, 1, 3} {2, 3, 1} {3, 1, 2} {3, 2, 1}
Where the numbers in red represent the fixed entries that assist in the process of excluding the fixed sets from the deranged sets. The two sets, {2, 3, 1} and {3, 1, 2}, lack the fixed-point property and thus total the subfactorial of 3 to equal 2.
Using the formula above, we get the following.
The sequence of subfactorials begins:

Double Factorial
A math double factorial, denoted as n!!, is the product of all integers from 1 up to n that have the same parity (odd or even) as n. It reduces the number by 2 in each step, rather than 1. For example, 5!! = 5 x 3 x 1 = 15 and 6!! = 6 x 4 x 2 = 48.
Double Factorial Formulas
- Odd : n!! = n(n-2)(n-4) … 3 x 1
- Even : n!! = n(n-2)(n-4) … 4 x 2
- Special Cases: 0!! = 1 and (-1)!! = 1
Key Examples and Properties
- 7!!: 7 x 5 x 3 x 1 = 105
- 8!!: 8 x 6 x 4 x 2 = 384
- Relationship to Factorial: n! = n!!(n-1)!!
- Even Conversion: For even n, n!! = (n/2)! 2(n/2)
Common Misconception
The double factorial n!! is not equivalent to (n!)! (nested factorial).
Primorial Factorial
A primorial (denoted n#) is the product of all prime numbers less than or equal to a given number n, similar to how a factorial (n!) multiplies all integers. It represents a “prime factorial” (2 x 3 x 5 x … x pn) and is crucial in number theory for prime gap analysis and constructing prime numbers.
Key Aspects of Primorials
- Definition: For a number n, the primorial n# is the product of all primes p ≤ n. For example, 5# = 5 x 3 x 2 = 30.
- Alternative Definition: Some contexts define pn# as the product of the first n primes (e.g., P3# = 2 x 3 x 5 = 30).
- Comparison to Factorial: While 5! = 5 x 4 x 3 x 2 x 1 = 120, the primorial 5# only multiplies the primes (30), making it grow slower than n! but still rapidly.
- Primorial Primes: Primes of the form n# ± 1 are called primorial primes, which are important in studying prime distributions.
- Properties: Primorials are bounded by n# ≤ 4n and are used in proofs regarding prime density.
Examples of Primorials
- 1# = 1
- 2# = 2
- 3# = 3 x 2 = 6
- 4# = 3 x 2 = 6 (no new prime)
- 5# = 5 x 3 x 2 = 30
- 10# = 7 x 5 x 3 x 2 = 210
Who
The following occupations use factorials.
- Mathematician
- Combinatorialist
- Computer scientist
- Algorithm engineer/developer
- Statistician
- Operations research analyst
- Logistics planner
- Educators
- Textbook authors
What
Subfactorials
Subfactorials, also known as derangements, have a few main applications:
- Probability and combinatorics:
- Subfactorials are used to calculate the probability of a “derangement” – a permutation of a set where no element is in its original position.
- They are useful in problems involving random arrangements, such as the “hat check problem” where n hats are returned to n people in a random order.
- Computer science and algorithms:
- Subfactorials are used in the analysis of certain algorithms, such as hash table implementations and the analysis of sorting algorithms.
- They arise in problems involving permutations where the order of elements matters but the actual values don’t.
- Mathematics and number theory:
- Subfactorials have connections to other mathematical sequences and concepts, such as the Bernoulli numbers and Stirling numbers.
- They are studied as an interesting class of integer sequences with their own properties and patterns.
Subfactorials have applications in probability, combinatorics, computer science, and mathematics, wherever problems involve reasoning about the number of possible permutations with certain constraints. They provide a way to quantify and analyze these types of situations. [5]
Double Factorial
Double factorials (n!!) are used by mathematicians, physicists, and statisticians to simplify products of exclusively odd or even numbers, primarily in combinatorics, probability, and integral calculus. They calculate pairings, volume formulas for hyperballs, and are essential in simplifying expressions involving the gamma function and normal distributions.
- Combinatorics: Used to count the number of ways to arrange objects in pairs (e.g., n people forming n/2 pairs) or connect points in specific graphs.
- Trigonometric Integrals: Originally introduced to solve integral problems, such as the derivation of the Wallis product.
- Geometry: Used in formulas for the volume of an n-dimensional hyperball and the surface area of a hypersphere.
- Statistics: Appears in the probability density function for the Student’s t-distribution and in the expansion of non-central chi-square distributions.
Primorial Factorial
Primorials (n#), defined as the product of all prime numbers less than or equal to n, are primarily used in number theory for analyzing prime number distribution, constructing prime sequences, and in cryptography. They identify gaps between primes, facilitate findings in additive prime theory, and generate highly composite numbers.
- Number Theory & Prime Searches: Primorials are crucial for finding prime numbers in arithmetic progressions and forming prime-rich sequences (e.g., pn# ± 1).
- Constructing Primes: They are used in Euclid’s proof of the infinity of primes and to find new primes; the number pn# + 1 is either prime or has a prime factor larger than pn.
- Highly Composite Numbers: Every highly composite number (a number with more divisors than any smaller positive integer) is a product of primorials.
- Base Systems & Computing: They are utilized to create efficient positional numeral systems (primorial number system) that have a lower proportion of repeating fractions.
- Radical of a Factorial: Primorials represent the square-free kernel of a factorial, n# = rad(n!), used in studying properties of integers.
- Cryptography: Similar to primorial primes, they are sometimes used in algorithms requiring large numbers with known, small, and distinct prime factors.
Why
See Theoretical Knowledge Vs Practical Application.
How
Many of the References and Additional Reading websites and Videos will assist you with understanding and applying factorials and subfactorials.
As some professors say: “It is intuitively obvious to even the most casual observer.“
References
[1] “Factorial: What Is Factorial? – Factorial Function in Maths.” 2021. BYJUS. BYJU’S. October 6. https://byjus.com/maths/factorial/.
[2] “Factorial – Meaning, Formula: Factorial of Hundred & 0.” 2024. CUEMATH. Accessed June 28. https://www.cuemath.com/numbers/factorial/.
[3] “Subfactorial.” 2023. Statistics How To. November 29. https://www.statisticshowto.com/subfactorial/.
[4] David G. Stork. “Using subfactorial in algebra”. Mathematics Stack Exchange. September 6, 2018. https://math.stackexchange.com/q/2907261.
[5] “Fast, Helpful AI Chat.” 2024. Poe. Assistant. Accessed June 15. https://poe.com/.

I used AI bots in this article to capture ideas I could not develop without more extensive research. I recall back in the 1990s attending presentations at conferences where the presenters were using crawler bots to gather information for their research. I am still experimenting with AI bots, and will continue to use them as needed to present ideas and concepts more clearly to the reader.
Additional Reading
Factorials
Connors, Matt. 2024. “Factorials and Their Applications in The Mathematical World.” Medium. Medium. December 8. https://matt-connors.medium.com/factorials-and-their-applications-in-the-mathematical-world-039b910ef0b5.
In this article, we’ll discuss the factorial operation, another mathematical operation involving repeated multiplication but very different from exponentiation. Factorial operations are very useful in cryptography, probability, and many others!
“What Is a Factorial in Maths: Notation, Formulas & Applications.” 2024. GeeksforGeeks. June 14. https://www.geeksforgeeks.org/factorial/.
The factorial of a natural number n indicates the number of ways n items can be arranged It plays an important role in various mathematical concepts such as permutations, combinations, probability, and many others. For a positive integer n, the value of factorial is multiplication of all positive integers less than or equal to n.
Subfactorials
“Find Subfactorial of a Number.” 2021. GeeksforGeeks. GeeksforGeeks. October 8. https://www.geeksforgeeks.org/find-subfactorial-of-a-number/.
Herman, Jaken. 2019. “Subfactorials - Another Twist on Factorials.” Medium. Medium. February 9. https://medium.com/@JakenH/subfactorials-another-twist-on-factorials-23eb81d200fb.
“Subfactorial !n Calculator – Online Derangement Finder”. 2024. dCode. Accessed June 28. https://www.dcode.fr/subfactorial.
Double Factorial
“Double Factorial Facts for Kids.” Accessed February 22, 2026. https://kids.kiddle.co/Double_factorial.
“Double Factorial.” Fandom, Inc., n.d. Accessed February 22, 2026. https://googology.fandom.com/wiki/Double_factorial.
“Double Factorial.” Wikipedia. February 19, 2026. https://en.wikipedia.org/wiki/Double_factorial.
“Double Fun with Double Factorials!!” happyruin. March 24, 2013. https://happyruin.wordpress.com/2013/03/24/double-fun-with-double-factorials/.
“What Is a Double Factorial?” Filo, June 5, 2025. https://askfilo.com/user-question-answers-smart-solutions/what-is-a-double-factorial-3335323235353534.
dgookin. “The Double Factorial.” C For Dummies Blog. Accessed February 22, 2026. https://c-for-dummies.com/blog/?p=6688.
r/desmos. “What Significance Do Double Factorials Have?” reddit.com. Accessed February 22, 2026. https://www.reddit.com/r/desmos/comments/1d7k20n/what_significance_do_double_factorials_have/.
Primorial Factorial
“Primorial Numbers.” Rosetta Code, February 21, 2026. https://rosettacode.org/wiki/Primorial_numbers.
“Primorial of a Number.” GeeksforGeeks, December 17, 2016. https://www.geeksforgeeks.org/dsa/primorial-of-a-number/.
“Primorial.” Fandom, Inc., n.d. Accessed February 23, 2026. https://prime-numbers.fandom.com/wiki/Primorial.
“Primorial.” OeisWiki. Accessed February 23, 2026. https://oeis.org/wiki/Primorial.
“Primorial.” Wikipedia, December 17, 2025. https://en.wikipedia.org/wiki/Primorial.
“The Prime Glossary: Primorial Prime.” Accessed February 23, 2026. https://t5k.org/glossary/page.php?sort=PrimorialPrime.
Videos
This math video tutorial provides a basic introduction into double factorials and contrasts it with single factorials and iterated factorials.
7 factorials you probably didn’t know
⭐ I suggest that you read the entire reference. Other references can be read in their entirety but I leave that up to you.
Medium Member Only
The featured image on this page is from the TBD on the TBD website.