I originally thought this question was too basic for MathOverflow, so I tried Math.StackExchange, but no one there seemed to have a solution. Here goes.
How many consecutive composite integers follow k!+1? I wrote a program in Mathematica to compute explicit answers for the first 300, but there doesn't seem to be much of a pattern. The results of that are here. This is a problem in Underwood Dudley's Elementary Number Theory (section 23.2 part (b)), but for the LIFE of me, I can't figure it out! My initial thought was this: Let m be the smallest prime such that k<m. Then any number of the form k!+i, where 1<i<m will clearly be composite. Hence, there are at least m-2 composite numbers which follow k!+1. However, past that it seems hard to say. For example, 11!+13 factorizes as 199*200587, which seems to be unpredictable behavior. I'm leaning toward thinking this was a misprint in the book and it's a much harder problem than something that should be in Elementary Number Theory. Perhaps I'm overlooking a simple, elegant solution.
The other thing is, if there were a closed-form solution, then we would have an easy formula for calculating arbitrarily large primes. Take the largest known prime p and suppose we determine that q composite numbers follow p!+1. Then p!+2+q is prime.


m-2, wheremis as I defined it (the least prime greater than or equal tok). – Willy Feb 2 2011 at 9:08