Testing primes using factorials

AI Thread Summary
The discussion explores the relationship between factorials and prime numbers, specifically through the equations n!/n^2=x and n-1!/n=x. It suggests that if x is a natural number, n is composite, while if x is a non-natural number, n is prime, except for the case of 4. A key argument is presented that if n is prime, then (n-1)!/n cannot be an integer, reinforcing the connection between factorials and primality. The method discussed is deemed impractical for testing large primes, especially given the demands of modern encryption systems. Overall, while the approach is interesting, it lacks efficiency for large number testing.
binbots
Messages
170
Reaction score
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
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.
 
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.
 
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).
 
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
 
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
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Is it possible to arrange six pencils such that each one touches the other five? If so, how? This is an adaption of a Martin Gardner puzzle only I changed it from cigarettes to pencils and left out the clues because PF folks don’t need clues. From the book “My Best Mathematical and Logic Puzzles”. Dover, 1994.
Thread 'Imaginary Pythagoras'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top