Some numbers are special. We call them prime numbers. They have a neat trick. If you multiply numbers together, they fit a rule. This rule helps us find them. Do you like number tricks?
Some numbers are special. We call them prime numbers. They follow a neat rule.
Pick a prime number. Multiply all the numbers smaller than it. For example, try the number five. Multiply one, two, three, and four. That makes twenty-four.
Twenty-four is one less than twenty-five. Twenty-five is a multiple of five. This trick works for all prime numbers.
A man named John Wilson found this. A teacher named Edward Waring told others about it.
Later, a man named Lagrange proved it was true. It is a very elegant rule for math.
Prime numbers are very special. They follow a neat rule. This rule is called Wilson's theorem.
To test a number, you can use a trick. Pick a number. Multiply all the smaller numbers together. For example, pick the prime number five. Multiply one, two, three, and four. That makes twenty-four.
Twenty-four is one less than twenty-five. Since twenty-five is a multiple of five, the rule works! This works for every prime number. If a number is not prime, the rule will not work.
Many people worked on this idea. A man named Ibn al-Haytham first stated it. Later, Edward Waring told the world about it in 1770. He said his student, John Wilson, found the rule.
Joseph Louis Lagrange gave the first proof in 1771. Another thinker named Leibniz may have known it too. He saw the rule but did not prove it. Today, we use this rule to study how numbers work. Even though it is hard to use for big numbers, it is a very elegant part of math.
Prime numbers are special because they only have two factors. They can only be divided by one and themselves. Mathematicians use many tricks to find these numbers. One elegant trick is called Wilson's theorem. This theorem uses a special math idea called a factorial. A factorial is what you get when you multiply a whole group of numbers together. For example, the factorial of four is one times two times three times four.
Wilson's theorem tells us exactly how factorials behave with prime numbers. If you pick a prime number, let's call it n, you should look at all the numbers smaller than it. Multiply all those smaller numbers together to get a big result. This result will always be exactly one less than a multiple of n. This means if you add one to that big result, it divides perfectly by n. If the number is not prime, this neat rule will not work.
Many smart people have studied this rule over hundreds of years. The idea was first stated by Ibn al-Haytham. Later, Edward Waring announced the theorem in 1770. He did not prove it himself, but he credited his student, John Wilson. Waring called the property of prime numbers very elegant. He even wrote about it in his book called Meditationes Algebraicae.
History shows that others may have known the rule too. A thinker named Leibniz likely saw the rule a century before Waring. However, Leibniz never published his work or proved the idea. It was not until 1771 that Joseph Louis Lagrange gave the first real proof. This proof helped show why the rule must always be true for primes.
Even though the rule is beautiful, it is hard to use for big numbers. Calculating huge factorials takes a very long time for computers. This makes it a poor way to test if a giant number is prime. Still, the theorem is very useful for other parts of math. It helps scientists study things like quadratic residues and special math functions. It connects different ideas in number theory together in a wonderful way.
Wilson's theorem is a fundamental result in number theory and algebra. It provides a specific way to identify prime numbers using factorials. A prime number is a natural number greater than 1 that has no divisors other than 1 and itself. Wilson's theorem states that a natural number $n > 1$ is prime if and only if the product of all positive integers less than $n$ is one less than a multiple of $n$. In the language of modular arithmetic, this means the factorial of $n-1$ is congruent to $-1$ modulo $n$.
To understand the mechanism, we must look at the factorial, written as $(n-1)!$. This is the product of every integer from 1 up to $n-1$. The theorem acts as a biconditional statement, meaning it works in both directions. If $n$ is prime, the factorial property must hold. If the factorial property holds, $n$ must be prime. For example, if $n$ is 5, the product is $1 \times 2 \times 3 \times 4$, which equals 24. Since 24 is one less than 25, and 25 is a multiple of 5, the theorem holds.
The theorem behaves differently depending on whether $n$ is prime or composite. When $n$ is a composite number, the product $(n-1)!$ usually results in a multiple of $n$, meaning the remainder is 0. For instance, if $n$ is 6, the product is $1 \times 2 \times 3 \times 4 \times 5$, which is 120. Since 120 is divisible by 6, the remainder is 0, not $n-1$. The only exception to this rule is $n=4$, where the remainder is 2. For all other composite numbers, the product is congruent to 0 modulo $n$.
The history of this discovery spans several centuries and many brilliant minds. The theorem was first stated by the scholar Ibn al-Haytham. Much later, in 1770, Edward Waring announced the theorem in his work, *Meditationes Algebraicae*. Waring did not provide a proof, but he credited his student, John Wilson, for the discovery. He described the property as "most elegant." There is also evidence that Gottfried Wilhelm Leibniz glimpsed the theorem a century earlier. However, Leibniz never published his findings or completed a formal proof.
Formal proofs eventually arrived to solidify the theorem's place in mathematics. Joseph Louis Lagrange provided the first official proof in 1771. One elementary way to prove the prime case involves the concept of multiplicative inverses. In a prime field, every non-zero number has a unique partner that multiplies to 1 modulo $n$. Most numbers in the factorial product pair up this way, leaving only 1 and $n-1$ unpaired. Since $n-1$ is congruent to $-1$ modulo $n$, the entire product results in $-1$.
While mathematically beautiful, the theorem has limited practical use for primality testing. Calculating a factorial for a very large number is computationally expensive. Even powerful computers find it "extremely laborious" and "almost impracticable" to use this method for massive numbers. Instead, mathematicians use more efficient algorithms to check for primes. However, the theorem remains significant for theoretical work. It helps define the $p$-adic gamma function and assists in studying quadratic residues.
Wilson's theorem also connects to advanced topics like Gauss's generalization. Carl Friedrich Gauss expanded the idea to include cases where $n$ is a power of an odd prime. He showed that the product of integers less than $n$ and relatively prime to $n$ follows specific patterns. These patterns depend on whether $n$ is a power of an odd prime or twice a power of an odd prime. This connection shows how a simple rule about prime numbers can grow into a complex system of mathematical laws.
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
🪜 Step back
Simpler topics to build understanding
What is Nepedia?
A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.