Jump to content
BrainDen.com - Brain Teasers
  • 0

Modular Factorial


plasmid
 Share

Question

Find all positive integers n such that (n-1)! modulo n = n-1.

More importantly, prove your answer.

This was something I noticed back in grade school while bored and playing around with a calculator, and only recently found out is an actual theorem that doesn't seem to be used for anything. But the proof is neat.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

For a non-prime n, the number (n-1)! will have n's factors. So (n-1)! modulo n will be 0. So it has to be a prime number that satisfies the equation.

What remains to prove is that for a prime n, the modulo is equal to n-1.

For n=4 this does not work.

(n-1)!=6

6 modulo 4 = 2

what do you mean when you say (n-1)! will have n's factors?

Edited by thoughtfulfellow
Link to comment
Share on other sites

  • 0

n = (n-1)!

n = 0 + 1 + 2 + 3 + 4 + ..... + (n-1)

n = (n-n) + (n-(n-1)) + ................ + (n-3) + (n-2) + (n-1)

n = n^2 - n!

n = n^2 - n(n+1)/2 .......... n! = n(n+1)/2

2 = 2n - (n+1) .......... multiplying b.s. by 2/n

2 = 2n - n - 1

2 = n - 1

3 = n

n = 3

Link to comment
Share on other sites

  • 0

Robo is correct about which numbers will satisfy this equation. Now it's just a matter of proving it.

Welcome to brainden wasim. This problem uses mudulo arithmetic, which often isn't taught in school (at least it wasn't for me). It essentially means considering only the remainder of a number after it's divided by another number. For example to calculate 17 modulo 5: 17 divided by 5 would be 3 with a remainder of 2, so 17 mod 5 = 2. That's what makes this problem tricky.

Link to comment
Share on other sites

  • 0

For a non-prime n, the number (n-1)! will have n's factors. So (n-1)! modulo n will be 0. So it has to be a prime number that satisfies the equation.

What remains to prove is that for a prime n, the modulo is equal to n-1.

I think what he means is that

Every composite number(n) other than a square of a prime will have at least four factors,

1, a, b, and n (where a and b are distinct and less than n and a*b=n)

As a, b are both less than n, they will be present in (n-1)!. We can take them out and as a*b=n, (n-1)! is divisible by n.

So remainder is 0.

Squares of primes will have three factors.

1, a, n (where a*a=n)

For squares of prime numbers greater than or equal to 3, a and 2a will be present in (n-1)!

(For example when n=9, a=3 and 2a=6 are present in 8!

n=25, a=5 and 2a=10 are present in 24!)

We can take both the a's out and as a*a=n, (n-1)! is again divisible by n.

So remainder=0 is true for all composite numbers except 4.

For 4, remainder is not 0, but it is not (n-1) either.

So the property (n-1)! modulo n = n-1 can only be satisfied by prime numbers.

Edited by SMV
Link to comment
Share on other sites

  • 0

by Euclid's multiplication theorem (not sure its real name) if you multiply by a series of numbers and add one, the new number will not be divisible by any of the numbers you multiplied by. therefore, it is either itself prime, or divisible by a prime not in the multiplication.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...