Find all possible pairs (n, k) of positive integers that satisfy this equation:
n! + n = n^k
Lets start by taking care of the edge cases n=0 and n=1
0! + 0 = 0 and 1! + 1 = 1 are false so no solutions here.
Then n>=2, so dividing by n or n-1 is now valid.
Now we can start rearranging things a bit
n*(n-1)! = n*(n^(k-1) - 1)
Now divide out the n
(n-1)! = n^(k-1) - 1
Take this equation mod n and we get
(n-1)! = -1 mod n
By Wilson's Theorem n is prime.
Now lets go further and factor out n-1
(n-1)*(n-2)! = (n-1)*[n^(k-2) + n^(k-3) + ... + n + 1]
Then divide out the n-1
(n-2)! = n^(k-2) + n^(k-3) + ... + n + 1
Note the right side contains k-1 terms.
We know that n is prime, lets assume n>=7. Now take both sides mod n-1. Then
(n-2)! = k-1 mod n-1
n-1 is a composite number >=6. Then also by Wilson's theorem (n-2)! = 0 mod n-1
Then k-1 = 0 mod n-1
k obviously needs to be greater than 1. Then the smallest k is k=n. Circling back to the original equation then we must have n! + n = n^n
But n^n grows so much faster than n! there are clearly no solutions with n>=7.
n is prime and less than 7, so there are only three candidates: n=2, n=3 and n=5.
If n=2 then 2!+2 = 2^k, then k=2.
If n=3 then 3!+3 = 3^k, then k=2.
If n=5 then 5!+5 = 5^k, then k=3.
All possible pairs (n, k) of positive integers that satisfy the given equation are (2, 2), (3, 2), and (5,3).