I wrote a program for myself in Mathematica to generate the answer for the first 300, which was really easy, but I can't find a pattern. The results are here. This is a problem in Underwood Dudley's Elementary Number Theory, 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-2
. This is quite clearly not the answer based on the link I provided. My logic was that any number of the form k!+n
will be composite when 1
Edit: For anyone curious, this is problem 2 part (b) in section 23.2 of the Second Edition of Underwood Dudley's Elementary Number Theory. Part (a) asks what the smallest integer n
is such that n+1, n+2, n+3,
and n+4
are all composite.
Second edit: Milcak's comment made me realize that, given some arbitrary n
, we can write k!+n=k!+i+j
so long as i+j=n
. I'm thinking about this now...
Third edit: Here is another problem with the concept for me. I feel like the primes less than or equal to k should help us predict the divisbility of k!+i
, and indeed they do, not when i
is a prime greater than k
. For example, 11!+13=199*200587
. That sort of behavior seems unpredictable to me.