Total Pageviews

Search This Blog

Saturday, November 4, 2023

Wilson's Theorem and A New Definition for Prime Numbers

Wilson's Theorem states that if p is prime, then the expression 1 + (p - 1)! is divisible by p. 

For example, if p = 5, we get 

1 + (5 - 1)! = 1 + 4!

1 +24 = 25

25/5 = 5

Another way of saying this is that 25 divided by 5 with a modulus of 5 is 0, because there is no remainder.

Unfortunately, factorials rapidly increase in magnitude. The largest factorial the online calculator Desmos can compute is 169 which has 300 or so digits. 

However, we can say that primes are the divisors for which factorials plus one are divisible. This an intriguing conclusion. 

Is there a way to simplify the computation of this theorem? I think so. 

Suppose we want to find if 19 is prime using Wilson's Theorem and we know the largest prime less than 19.

1 + (19 - 1)! = 1 + 18!

If we divide 18! by the factorial of the largest prime less than 19!, we get 18!/17! = 18.

18 + 1 = 19

19/19 = 1

We can generalize this for every case of twin primes, p and p + 2. 

1 + (p + 2 - 1)! = 1 + (p + 1)!

(p + 1)!/p! = p + 1

p + 1 + 1 = p + 2

(p + 2)/(p + 2) = 1

I'm not sure how to handle other prime gaps, but I suspect there is a way. Earlier this year, I made a conjecture about the squares of primes which a friend later proved. It states that for any two primes 5 or greater, the difference of their squares is always a multiple of 24. For example, 7^2 - 5^2 = 24. This relation holds even when the primes are not consecutive:

11^2 - 5^2 = 96 = 4*24

The downside is that there are composite numbers that act the same way when paired with a prime. These cases are rare for numbers less than 100,000. 

Let's try a more challenging case. Suppose we want to find the next prime larger than 100,003. We could first try 100,005 and see if the difference of squares is a multiple of 24.

(100005^2-100003^2)/24 is not an integer, so we can repeat the process by moving up 2 to 100,007.

(100007^2-100003^2)/24 is an integer, but this does not prove that 100,007 is the next larger prime. If we return to Wilson's Theorem, we see that:

1 + (100,007 - 1)! = 1 + 100,006!

100,006!/100,003! = 100,006*100,005*100,004

(1 + 100,006*100,005*100,004)/100,007

We can use our old friend the Big Number Calculator to evaluate this monster expression.

Big Number Calculator

And when we do, we find the result is not an integer, though it is very close to being so. Thus, 100,007 is not prime. 

(100,019^2 - 100,003^2)/24 is an integer, so it passes the first test.

1 + (100,019 - 1)! = 1 + 100,018!

100,018!/100,003! = 100,018*100,017...*100,004

The remaining steps of the calculation I leave as an exercise for the reader. 

No comments: