Determine all possible values of an integer n that satisfy this equation:
n! + n = n2
Lets test small cases:
n=0 makes 1+0=0 false
n=1 makes 1+1=1 false
n=2 makes 2+2=4 true
n=3 makes 6+3=9 true
n=4 makes 24+4=16 false
So n=2 and n=3 are solutions. So lets prove there are no larger solutions.
Since we have testes all the small values we can freely assume n>2. Divide both sides by n-2 and clean up the algebra. Then the equation becomes n*(n-1)*(n-3)! + 1 = n+2 + 2/(n-2).
2/(n-2) must be an integer, but that can only happen when the fraction reduces to 1 or 2. Those values of n are 3 and 4, and we have already tested those cases. Any larger value of n will make the fraction be non-integral and then the equation will be false. So there are no more solutions.