Ask for which n the number n! + 1 is a square, and three answers arrive immediately: 4! + 1 = 25 = 5², 5! + 1 = 121 = 11² and 7! + 1 = 5041 = 71². The first link takes 7! and adds one, the second squares 71, and the two land on the same 5041; the third and fourth links are the smaller solutions. A fourth does not exist anywhere below n = 10⁹, which is as far as the computer searches have been carried, and the neighbourhood of 7 is instructive rather than encouraging: 6! + 1 = 721 = 7 × 103 and 8! + 1 = 40 321 = 61 × 661, so the run of squares fails on both sides.
Nobody can prove the list is finished, and the reason it is hard is that factorials and squares belong to different parts of arithmetic. What can be said is one-sided: if a solution exists beyond 7 then n is enormous, and the abc conjecture — unproved, and about the sizes of coprime parts of a + b = c — would imply that only finitely many exist at all. The smallest solution has a second celebrity attached to it. Since (p − 1)! + 1 is divisible by p whenever p is prime, n = 4 gives 5² and so 5² divides 4! + 1; primes p whose square divides (p − 1)! + 1 are Wilson primes, and only three are known, 5, 13 and 563. The list of pairs and the list of Wilson primes overlap in exactly one number, and it is this one.
Answer
5041
How to read it
7! + 1 on the workbench. The second link squares 71 and lands on the same number; the third and fourth are 4! + 1 and 5! + 1.
Source
Henri Brocard, 1876: for which n is n! + 1 a perfect square; the three known solutions n = 4, 5 and 7 give the pairs (4, 5), (5, 11) and (7, 71), which are called Brown numbers
Work it in the calculator
These links open the right calculator with this problem's numbers already typed in. The line above is what the screen should show — check it yourself.