I have to summon Fermat again

It can be shown that, for all positive integers n n ,

  • n 3 n n^3 -n is divisible by 6 and
  • n 5 n n^5 - n is divisible by 30.

Find the largest positive integer M M such that the following is true:

n 7 n n^7 - n is divisible by M M for all positive integers n . n.


The answer is 42.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

13 solutions

First, as 7 7 is prime, by Fermat's Little Theorem n 7 n ( m o d 7 ) n 7 n 0 ( m o d 7 ) n^{7} \equiv n \pmod{7} \Longrightarrow n^{7} - n \equiv 0 \pmod{7} . So n 7 n n^{7} - n is divisible by 7 7 for all positive integers n n .

Next, note that n 7 n = n ( n 6 1 ) = n ( n 3 1 ) ( n 3 + 1 ) = n ( n 1 ) ( n 2 + n + 1 ) ( n + 1 ) ( n 2 n + 1 ) n^{7} - n = n(n^{6} - 1) = n(n^{3} - 1)(n^{3} + 1) = n(n - 1)(n^{2} + n + 1)(n + 1)(n^{2} - n + 1) .

Now since the factors n 1 , n n - 1, n and n + 1 n + 1 are three consecutive integers we know that precisely one of them is divisible by 3 3 , and also that at least one of them is divisible by 2 2 , and so n 7 n n^{7} - n will be divisible by 3 × 2 = 6 3 \times 2 = 6 .

Thus as n 7 n n^{7} - n is divisible by both 7 7 and 6 6 it will be divisible by 7 × 6 = 42 7 \times 6 = 42 for all positive integers n n . But is this the maximum possible value M M ?

Now 2 7 2 = 126 = 42 × 3 = 14 × 9 2^{7} - 2 = 126 = 42 \times 3 = 14 \times 9 , so we need to check out if M M could equal 126 126 . But

3 7 3 = 3 × 3 6 3 = 3 × 9 3 3 0 3 ( m o d 9 ) 6 ( m o d 9 ) 3^{7} - 3 = 3 \times 3^{6} - 3 = 3 \times 9^{3} - 3 \equiv 0 - 3 \pmod{9} \equiv 6 \pmod 9 ,

i.e., we have at least one case where n 7 n n^{7} - n is not divisible by 9 9 , and hence also not divisible by 126 126 . Thus we can conclude that M = 42 M = \boxed{42} .

This is the simplest solution to follow. Thank you.

Pi Han Goh - 2 years, 7 months ago

Log in to reply

I think the same. Very nice solution.

A Former Brilliant Member - 2 years, 7 months ago

How did you factor out there at the 3rd step?

Tobias Weger - 2 years, 7 months ago

Log in to reply

Are you referring to the third step on the second line? If so, then note that in general

a 3 b 3 = ( a b ) ( a 2 + a b + b 2 ) a^{3} - b^{3} = (a - b)(a^{2} + ab + b^{2}) and a 3 + b 3 = ( a + b ) ( a 2 a b + b 2 ) a^{3} + b^{3} = (a + b)(a^{2} - ab + b^{2}) .

Brian Charlesworth - 2 years, 7 months ago

The question, “But is this the maximum possible value M?” can also be answered without using modular arithmetic:

1) With n=2, 2⁷ – 2 = 126

2) With n=3, 3⁷ – 3 = 2184

3) gcd(126, 2184) = 42, where gcd(…) refers to the greatest common divisor of the specified integers.

4) We saw that (n⁷–n) is always divisible by 42 for all integers n (not just positive values of n). For the specific cases n=2 and n=3, gcd(126, 2184) = 42. Thus, there can be no greater common divisor across all integer values of n.

5) Thus gcd(n⁷–n, for all integers n) = M = 42.

NOTE: Fermat’s Little Theorem holds for all values of n, not just positive values. There is also nothing in Brian Carlesworth’s proof to limit n to positive numbers. Thus the original requirement, that n be positive, is not necessary as the solution works with any integer n.

Bert Sierra - 2 years, 7 months ago

Log in to reply

Great insight using GCD!

Seq O - 2 years, 7 months ago

is there a non modular way of showing it is divisible by 7

Mudit T - 2 years, 4 months ago
Otto Bretscher
Oct 22, 2018

I'm attempting to show the following more general result: For N > 1 N>1 , the largest M M such that n N n n^N-n is divisible by M M for all positive n n is M = ( p 1 ) ( N 1 ) p M=\prod_{(p-1)|(N-1)}p , where p p is a prime. In the case of N = 7 N=7 we find M = 2 × 3 × 7 = 42 M=2\times3\times7=\boxed{42} .

For a prime p p , we have n N n ( m o d p ) n^N\equiv n \pmod{p} iff n N 1 1 ( m o d p ) n^{N-1}\equiv 1 \pmod{p} for all n n that are not divisible by p p . Fermat tells us that this is the case iff p 1 N 1 p-1|N-1 . Note that M M is squarefree since p N p p^N-p fails to be divisible by p 2 p^2 .

Oh god, this is so beautiful!

Pi Han Goh - 2 years, 7 months ago

the most fascinating method for this question

cola cola - 2 years, 7 months ago
Jordan Cahn
Oct 22, 2018

Note that 5 does not necessarily divide n 7 n n^7-n since 2 7 2 = 126 2^7-2 = 126 is not divisible by 5 5 .

By Fermat's Little Theorem , n 7 n m o d 7 n^7\equiv n\bmod 7 and thus n 7 n n^7 - n is divisible by 7 7 . Now, factor: n 7 n = ( n 1 ) n ( n + 1 ) ( n 2 n + 1 ) ( n 2 + n + 1 ) n^7-n = (n-1)n(n+1)(n^2 - n + 1)(n^2 + n + 1) Since n 1 n-1 , n n , and n + 1 n+1 are three consecutive integers, at least one must be even and one must be divisible by 3 3 . Thus both 2 2 and 3 3 divide n 7 n n^7-n as well. Now, let p > 7 p>7 be prime and let n = 2 n = 2 n 7 n = ( n 1 ) n ( n + 1 ) ( n 2 n + 1 ) ( n 2 + n + 1 ) = 1 × 2 × 3 × 3 × 7 ≢ 0 m o d p Since 2 , 3 , 7 < p \begin{aligned} n^7-n &= (n-1)n(n+1)(n^2 - n + 1)(n^2 + n + 1) \\ &= 1\times 2\times 3\times 3\times 7 \\ &\not\equiv 0 \mod p &&\color{#3D99F6} \text{Since }2,3,7<p \end{aligned} Thus n 7 n n^7-n is not divisible by p p for any prime greater than 7 7 .

At this point, we know that M = 2 a 3 b 7 c M=2^a3^b7^c . We now show that a = b = c = 1 a=b=c=1 . We do this by showing that, with the proper choice of n n , n 7 n n^7-n is not divisible by p 2 p^2 for prime p p :

Let n = p n = p . Then n 7 n = ( n 1 ) n ( n + 1 ) ( n 2 n + 1 ) ( n 2 + n + 1 ) = ( p 1 ) p ( p + 1 ) ( p + 1 ) ( p + 1 ) ≢ 0 m o d p 2 Since none of p 1 , p + 1 , p + 1 are divisible by p , p appears only once as a factor \begin{aligned} n^7-n &= (n-1)n(n+1)(n^2 - n + 1)(n^2 + n + 1) \\ &= (p-1) p (p+1) (-p+1) (p+1) \\ &\not\equiv 0\mod p^2 && \color{#3D99F6}\text{Since none of }p-1, p+1, -p+1 \text{ are divisible by }p\text{, }p\text{ appears only once as a factor} \end{aligned}

Therefore, M = 2 × 3 × 7 = 42 M=2\times 3\times 7 = \boxed{42} .


As an alternative to the last step, one could also use n = 42 n=42 . Then n 7 n = 230 , 539 , 333 , 206 n^7-n = 230,539,333,206 which is not divisible by 4 4 , 9 9 or 49 49 .

n=6, giving 279,930 also works as demonstration of the last step I believe. It is not divisible by 4, 9 or 49.

Steven Perkins - 2 years, 7 months ago

Log in to reply

Good point.

Jordan Cahn - 2 years, 7 months ago

Oh wow, this is a very unexpected approach. I like you how you break it down to M = 2 a 3 b 7 c M = 2^a 3^b 7^c .

Pi Han Goh - 2 years, 7 months ago

42 in my head in less then 9 seconds

Jason Haughey - 2 years, 7 months ago

Log in to reply

I don't know what your point is. It's one thing to see (or guess) the likely solution. It's another thing to prove it.

Jordan Cahn - 2 years, 7 months ago
Stephan E
Oct 30, 2018

Let f(n) = n^7 - n.

We start with n=2.

What ist the max. factor of f(2)? It is 7.

gcd( f(2), f(3), f(4), f(5), f(6) ) = 42 =M

You have only worked on the five numbers f(2), f(3), f(4), f(5), f(6).

How do you know that f(7), f(8), .... are all divisible by 42 as well?

Pi Han Goh - 2 years, 7 months ago

Log in to reply

That's what I did, but I don't know how to prove it for all natural numbers as you say, Pi Han Goh :(

(¿Is this university level?)

Diego González - 2 years, 7 months ago
K T
Oct 29, 2018

2 7 2 = 126 2^7-2=126 , so M must be a divisor of 126 = 2 × 3 2 × 7 126=2×3^2×7 .

Also 3 7 3 = 2184 3^7-3=2184 , so M must also be a divisor of 2184 = 2 3 × 3 × 7 × 13 2184=2^3×3×7×13 .

Combined we now know that M must be a divisor of 2 × 3 × 7 = 42 2×3×7=42 , we only need to prove that 42 works indeed. Using modular arithmetic, we see that for any p: 0 7 0 0 0^7-0≡0 , 1 7 1 0 1^7-1≡0 and ( 1 ) 7 ( 1 ) 0 (-1)^7-(-1)≡0 (mod p). And Fermats little theorem ensures that n 7 n = 0 n^7-n=0 (mod 7). The facts n 7 n 0 n^7-n≡0 (mod 2), n 7 n 0 n^7-n≡0 (mod 3), and n 7 n 0 n^7-n≡0 (mod 7) combine into n 7 n 0 n^7-n≡0 (mod 42).

Yay! Super neat!

Pi Han Goh - 2 years, 7 months ago

Log in to reply

Thanks for the compliment!

K T - 2 years, 7 months ago

L e t f ( n ) = n 7 n . f ( 2 ) = 126 = 9 14 = 3 42. f ( 3 ) = 2184 = 52 42 ; M 42. f ( n ) = n ( n 6 1 ) = n ( n 2 1 ) ( n 4 + n 2 + 1 ) = { ( n 1 ) n ( n + 1 ) } { n 4 + n 2 + 1 } . ( n 1 ) n ( n + 1 ) i s p r o d u c t o f t h r e e c o n s e c u t i v e i n t e g e r s . 6 i s i t s d i v i s o r o f f ( n ) . l e t u s s e e i f 42 6 = 7 i s a d i v i s o r o f f ( n ) o r n o t . n 4 + n 2 + 1 = 14 n 2 35 { ( n 2 2 2 ) ( n 2 3 2 ) } f ( n ) = ( n 1 ) n ( n + 1 ) { 7 ( 2 n 2 5 ) ( n 2 2 2 ) ( n 2 3 2 ) } . f ( n ) = 7 ( n 1 ) n ( n + 1 ) ( 2 n 2 5 ) ( n 3 ) ( n 2 ) ( n 1 ) ( n ) ( n + 1 ) ( n + 2 ) ( n + 3 ) . B u t ( n 3 ) ( n 2 ) ( n 1 ) ( n ) ( n + 1 ) ( n + 2 ) ( n + 3 ) i s a p r o d u c t o f s e v e n c o n s e c u t i v e i n t e g e r s . S o 6 a n d 7 a r e a l s o i t s d i v i s o r s . 7 ( n 1 ) n ( n + 1 ) ( 2 n 2 5 ) a n d ( n 3 ) ( n 2 ) ( n 1 ) ( n ) ( n + 1 ) ( n + 2 ) ( n + 3 ) h a s 6 7 = 42 a s d i v i s o r o f f ( n ) . S o M = 42 s i n c e w e s a w a b o v e t h a t 42 i s o n l y c o m m o n f a c t o r o f f ( 2 ) a n d f ( 3 ) . Let~f(n)=n^7 - n.\\ f(2)=126=9*14=3*42.\\ f(3)=2184=52*42;\\ \implies~M\leq 42.\\ f(n)=n(n^6-1)=n(n^2-1)(n^4+n^2+1)=\{(n-1)n(n+1)\}\{n^4+n^2+1\}.\\ (n-1)n(n+1)~is~product~of~three~consecutive~integers.~\therefore~6~is~its~divisor~of~f(n).\\ \therefore~let~us~see~if~\dfrac{42} 6=7 ~is~a~divisor~of~f(n)~or~not. \\ n^4+n^2+1=14n^2-35 - \{(n^2-2^2)(n^2 - 3^2)\}\\ \implies~f(n)=(n-1)n(n+1)\{7(2n^2-5)-(n^2-2^2)(n^2 - 3^2)\}.\\ \therefore~f(n)=7(n-1)n(n+1)(2n^2-5) - (n-3)(n-2)(n-1)(n)(n+1)(n+2)(n+3).\\ But~(n-3)(n-2)(n-1)(n)(n+1)(n+2)(n+3)~is~ a~ product~ of~ seven~consecutive~integers.\\ So~ ~6~~and~~7~~are~also~its~divisors.\\ \implies~7(n-1)n(n+1)(2n^2-5)~~and~~(n-3)(n-2)(n-1)(n)(n+1)(n+2)(n+3)\\ has~6*7=42~as~divisor~of~f(n).\\ So~M=42 ~since~we~saw~above~that~42~is~only~common~factor~of~f(2)~and~f(3).

Niranjan Khanderia - 2 years ago
Paul Cockburn
Oct 29, 2018

Without invoking Fermat's Little Theorem: A simple experiment with a spreadsheet showed that for n=2 then n 7 n n^{7}-n = 126 which is 3 x 42 whereas if n=3 then n 7 n n^{7}-n = 2184 which is 52 x 42. Given that 3 and 52 are mutually prime the number M we are seeking cannot be greater than 42. So, is it 42?

Factorising as much as I can gives n 7 n = n ( n 6 1 ) = n ( n 3 1 ) ( n 3 + 1 ) = n ( n 1 ) ( n 2 + n + 1 ) ( n 3 + 1 ) n^{7}-n = n(n^{6}-1) = n(n^{3}-1)(n^{3}+1) = n(n-1)(n^{2}+n+1)(n^{3}+1)

It is clear that either n or n-1 is divisible by 2.

Working mod 3, then either n \equiv 0 or n \equiv 1 (in which case n-1 \equiv 0) or n \equiv 2 (in which case n 3 + 1 8 + 1 2 + 1 n^{3}+1 \equiv 8+1 \equiv 2+1 \equiv 0)

Working mod 7 needs a little more effort:

n 0 n \equiv\ 0 implies n 0 n \equiv\ 0

n 1 n \equiv\ 1 implies n 1 0 n-1 \equiv\ 0

n 2 n \equiv\ 2 implies n 2 + n + 1 4 + 2 + 1 0 n^{2}+n+1 \equiv 4+2+1 \equiv\ 0

n 3 n \equiv\ 3 implies n 3 + 1 27 + 1 6 + 1 0 n^{3}+1 \equiv 27+1 \equiv 6+1 \equiv\ 0

n 4 n \equiv\ 4 implies n 2 + n + 1 16 + 4 + 1 2 + 4 + 1 0 n^{2}+n+1 \equiv 16+4+1 \equiv 2+4+1 \equiv\ 0

n 5 n \equiv\ 5 implies n 3 + 1 125 + 1 6 + 1 0 n^{3}+1 \equiv 125+1 \equiv 6+1 \equiv\ 0

n 6 n \equiv\ 6 implies n 3 + 1 216 + 1 6 + 1 0 n^{3}+1 \equiv 216+1 \equiv 6+1 \equiv\ 0

So M is a multiple of 2, 3 and 7 and not greater than 42. Hence M = 42 M = \boxed{42}

Yup, this is the simplest approach that I can think of. Thank you for sharing this! ;)

Pi Han Goh - 2 years, 7 months ago

Not sure if this has already been proposed. Here's an alternate solution, albeit tedious but more general, using binomials. Though not as elegant as Fermat's Little Theorem approach, it is a neat little property of binomials.

Any polynomial function f ( n ) f(n) of degree d d over any field that contains Q \mathbb{Q} can be expressed uniquely as the following linear combination, f ( n ) = k = 0 d F k ( n k ) f(n) = \sum_{k=0}^d F_k {n\choose k} where F k = t = 0 k ( 1 ) k t f ( t ) ( k t ) F_k=\sum_{t=0}^k(-1)^{k-t}f(t){k\choose t} is the k-th difference of the sequence { f ( i ) } i = 0 , 2 , , k \{f(i)\}_{i=0,2,\ldots,k} .

Solution to problem

Let f ( n ) = n 7 n f(n) = n^7 - n and so d = 7 d=7 , we can express it as f ( n ) = 126 ( n 2 ) + 1806 ( n 3 ) + 8400 ( n 4 ) + 16800 ( n 5 ) + 15120 ( n 6 ) + 5040 ( n 7 ) . f(n) = 126{n\choose 2} + 1806{n\choose 3} + 8400{n\choose 4} + 16800{n\choose 5} + 15120{n\choose 6} + 5040{n\choose 7}. The GCD of the coefficients in the equation is 42 \boxed{42} .

Wow, I haven't seen this approach before. I have to spend more time to digest this.

Pi Han Goh - 2 years, 7 months ago

Log in to reply

Binomials are cool. Anyway, just to help you get started, the k-th difference refers to a concept called finite difference in numerical analysis.

Entropy Uncertainty - 2 years, 7 months ago
Tom Verhoeff
Nov 1, 2018

By Fermat's Little Theorem, we have n p = n ( m o d p ) n^p=n \pmod p for all n n and primes p p , in particular for p = 2 , 3 , 5 , 7 p=2, 3, 5, 7 .

Thus, 7 divides n 7 n n^7-n .

Also 2 divides it, because n 7 = n n 2 n 2 n 2 = n n n n = = n ( m o d 2 ) n^7 = n \cdot n^2\cdot n^2\cdot n^2=n\cdot n\cdot n\cdot n = \ldots = n \pmod 2 .

Similarly, 3 divides it, since n 7 = n n 3 n 3 = n n n = n ( m o d 3 ) n^7=n\cdot n^3\cdot n^3=n\cdot n\cdot n=n \pmod 3 .

For p = 5 p=5 , this doesn't work, and also not for primes p > 5 p\gt5 .

Hence, the largest $M=2 \cdot 3 \cdot 7=42$ \fbox{\$M=2\cdot 3\cdot 7=42\$} .

Ervyn Manuyag
Oct 29, 2018

I tried every even number and then divide the one I got for the first one which 126 then when I tried 6 the answer wasn’t divisible by 6 so I tried 42 bcuz it is a factor of 126 and it actually works

You can't try every even number because there's infinitely many even numbers out there!

Pi Han Goh - 2 years, 7 months ago
Mylok isMe
Nov 2, 2018

42 is just always the answer

Abhinav Srijan
Oct 29, 2018

Just take the the case of 2 and 3 and find the common factors which are in both and multiply them

You're under the assumption that n 7 n n^7-n is divisible by 42 for n = 4 , 5 , 6 , n=4,5,6,\ldots as well. How can you show that?

Pi Han Goh - 2 years, 7 months ago
Vinod Kumar
Oct 29, 2018

(1) n^7-n=(n^3-n)(n^4+n^2+1), so it divides by 3.

(2) By Fermat's theorem, it divides by 7.

(3) It is even, it divides by 2.

Therefore, it divides by 2x3x7,

Answer=42

This solution is incomplete. You have not demonstrated that it n 7 n n^7 - n cannot be divisible by any integer larger than 42.

Pi Han Goh - 2 years, 7 months ago
Naren Bhandari
Oct 22, 2018

Since (M) is the largest value that evenly divides n 7 n n^7-n then n 7 n , ( n + 1 ) 7 ( n + 1 ) , ( n + k ) 7 ( n + k ) n^7-n , (n+1)^7-(n+1) , \cdots (n+k)^7 -(n+k) must share same gcd. The g.c.d ( n 7 n , ( n + 1 ) 7 ( n + 1 ) , ( n + 2 ) 7 ( n + 2 ) , ( n + k ) 7 ( n + k ) ) = 2 × 3 × 7 = 42 \text{g.c.d} \,(n^7-n, (n+1)^7-(n+1) , (n+2)^7-(n+2) ,\cdots (n+k)^7-(n+k) )= 2\times 3\times 7 = 42 And hence the answer.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...