We have 504=23⋅32⋅7.
a) ⇒ b). First we prove that (n,5)=1. If (n,5)=1 then n=5k.
The sequence (5m+2)m≥1 is an arithmetic sequence with ratio 5. Its first term being coprime with the ratio, from Dirichlet's Theorem it follows that the sequence contains infinitely many primes. Then, there exists a prime p such that p=5m+2 and p>n. As (p,n)=1 it follows that p6≡1(modn), i.e., n∣(5m+2)6−1. As 5∣n and (5m+2)6=M5+26, we get that 5 divides 63, absurd!
As (n,5)=1, according to the hypothesis 56≡1(modn), i.e. n∣(56−1).
But 56−1=(53−1)(53+1)=(5−1)(52+5+1)(5+1)(52−5+1)=4⋅31⋅6⋅21=23⋅32⋅7⋅31, hence n∣23⋅32⋅7⋅31 (1)
From (1) one can notice that (n,11)=1, hence 116≡1(modn), i.e., n∣(116−1). But 116−1=(113−1)(113+1)=(11−1)(112+11+1)(11+1)⋅(112−11+1)=10⋅133⋅12⋅111, therefore
n∣23⋅32⋅5⋅7⋅19⋅37(2)
From (1) and (2) it follows that n∣23⋅32⋅7, i.e., n∣504.
b) ⇒ a). Let x∈Z. Then x6−1=(x2−1)(x4+x2+1). We have:
1. if (x,2)=1 then x−1 and x+1 are consecutive even numbers, hence 23∣x6−1;
2. if (x,7)=1, from Fermat's Theorem we obtain 7∣x6−1;
3. if (x,3)=1 then x=3k±1. Obviously 3∣x−1 or 3∣x+1, hence 3∣x2−1. We also have
x4+x2+1=(3k±1)4+(3k±1)2+1=(M3+1)+(M3+1)+1=M3, i.e.,3∣x4+x2+1.
It follows that for (x,3)=1 we have 32∣x6−1.
If n∈N, n≥2 and n∣504, then n=2a⋅3b⋅7c with a∈{0,1,2,3}, b∈{0,1,2}, c∈{0,1} and a,b,c not all of them 0. From the three statements above it follows that for all integer x coprime with n we have n∣x6−1, i.e. x6≡1(modn).