Testing primes using factorials

In summary, there was a discussion about the equation n!/n^2=x or n-1!/n=x, and it was concluded that if x is a natural number, then n is composite and if x is a non-natural number, then n is prime (excluding 4). The conversation also touched on the fact that remainders left over from each prime number increase in value from .5 to .99999... and that this method is not very practical for testing very large numbers. Another method was suggested, but it was also deemed impractical for testing primes with hundreds of digits.
  • #1
binbots
170
3
As far as I can tell for the equation n!/n^2=x or n-1!/n=x, if x is a natural number then it seems n is composite. If x is a non-natural number then it is prime (excluding 4). I am aware that this is not very practical since I am using factorials and the numbers get very large. But it still seems interesting non the less. As of now I can only test up to n=86. Is there a easier way to check very large numbers? A better on line calculator perhaps? Or is all this something already known and/or disproving?

I also noticed that the remainder left over from each prime number increases in value from .5- to .999999... Since these remainders are generated by primes they seem to grow in prime proportions.
 
Last edited:
Mathematics news on Phys.org
  • #2
binbots said:
As far as I can tell for the equation n!/n^2=x or n-1!/n=x, if y is a natural number then it seems n is composite. If y is a non-natural number then it is prime (excluding 4).
I'm assuming you mean x throughout instead of y. You're trying to show that (n-1)!/n is a whole number if and only if n is not prime. There are lots of ways to play around with this statement, but I'll just leave some food for thought here. Assume that n is prime. This means that none of the numbers 2, 3, ..., (n-1) divide it. But of course, n doesn't divide any number less than it, and it doesn't divide their product either (by the fundamental theorem of arithmetic). So if n is prime, then n and (n-1)! are relatively prime (greatest common divisor = 1), meaning that the fraction (n-1)!/n is irreducible: that is, it can never be an integer.

I've just outlined an argument for "If n is prime, then (n-1)!/n is not an integer," which is equivalent to the contrapositive statement, "If (n-1)!/n is an integer, then n is not prime." The converse statement, "If n is not prime, then (n-1)!/n is an integer," is a little trickier to prove, but I'll let you take a crack at it first.
 
  • #3
Thanks for the correction. As for your food for thought I see now what I did. Makes sense. Seems I confused myself into some circular logic.
 
  • #4
This would be a much easier fraction to deal with:

With the (n-1)!/n fraction, you would be pretty much checking all the numbers that could not divide n. For example, if we picked 101, we would be checking all numbers up to 100, but with the fraction above, we would be checking only up to 10, which is the square root of 100 rounded down to the nearest integer [floor function] (it already is an integer, so 10).
also,
TeethWhitener said:
I've just outlined an argument for "If n is prime, then (n-1)!/n is not an integer," which is equivalent to the contrapositive statement, "If (n-1)!/n is an integer, then n is not prime." The converse statement, "If n is not prime, then (n-1)!/n is an integer," is a little trickier to prove, but I'll let you take a crack at it first.
(I deleted the first part) The converse statement just basically says that if n isn't prime, a combination of factors smaller than n multiply up to n with each factor not repeated, which is true for all composite numbers (excluding 4).
 
  • #5
I get it now. Thanks. When I couldn't find anything about this on line I thought It was either wrong or just uninteresting. Glad to know I am not wrong. Sad to hear it is just uninteresting. lol
 
  • #6
This method is more of an inefficient and therefore unpractical method of testing primes. With the RSA encryption system being used, computers are required to test primes up to hundreds of digits long, and with this method, even the floor-square root factorial, which would be around [15 to 100's] factorial.
However, another method like this but also impractical is to take the LCM of all the numbers up to the floor of the square root of n-1, and putting that over n. (so if it's an integer)
 
  • Like
Likes binbots

1. What is the concept behind testing primes using factorials?

The concept is based on the fact that any non-prime number can be expressed as a product of two or more smaller numbers. By using factorials, we can check for the presence of these smaller numbers and determine if a number is prime or not.

2. How does one use factorials to test for primes?

To test for primes using factorials, we first find the factorial of the number in question. Then, we check if the factorial has any factors other than 1 and itself. If it does, then the original number is not prime. If it does not, then the original number is prime.

3. Can factorials be used to test for all primes?

No, factorials can only be used to test for certain types of primes, such as factorial primes and primorial primes. These types of primes are defined as numbers that are either a factorial or a product of consecutive primes, respectively.

4. Are there any limitations to using factorials to test for primes?

Yes, there are limitations to using factorials to test for primes. One limitation is that factorials can only be used to test for certain types of primes, as mentioned before. Additionally, factorials can become quite large and computationally expensive to calculate for larger numbers, making this method less practical for testing extremely large primes.

5. How accurate is testing primes using factorials?

Testing primes using factorials is a reliable method as it is based on mathematical principles. However, as with any testing method, there is always a possibility of error. It is important to use proper algorithms and check for any edge cases when using factorials to test for primes.

Similar threads

Replies
1
Views
768
Replies
13
Views
1K
  • General Math
Replies
2
Views
991
  • General Math
Replies
12
Views
965
  • General Math
Replies
16
Views
3K
  • General Math
Replies
7
Views
1K
  • General Math
Replies
1
Views
1K
  • General Math
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
32
Views
3K
  • General Math
Replies
16
Views
1K
Back
Top