For a positive integer x drawn at random between 1 and 20000 inclusively, determine the probability that (x!+1)/(x+1) is a prime number.
first there is a simple proof that x+1 must be prime
(x!+1)/(x+1) = x!/(x+1) + 1/(x+1)
If x+1 is not prime then all of its prime factors are less than x and thus factors of x!, thus x!/(x+1) is an integer, since 1/(x+1) is only an integer x=2 then (x!+1)/(x+1) is only an integer when x+1 is prime. Thus we can drastically reduce the search space to the primes less than 20000. This reduces us from testing 20,000 values of x to only 2262. Making it feasable with a reasonably fast home computer.
Now I am currently using the following Mathematica code to search for solutions.
#Begin code#
f[x_]:=(x!+1)/(x+1);
lst={};
lmt=PrimePi[20000];
cnt=0;
Print[Dynamic[lst]]
i=0;
ProgressIndicator[Dynamic[i/lmt]]
For[i=1,i<=lmt,++i,
x=Prime[i]1;
p=f[x];
If[PrimeQ[p],
++cnt;
lst=Append[lst,x];
];
];
#end code#
so far it has returned the following x values:
4,6,10,28,772,1320
unfortunately I am currently at work and only have my netbook to run this code on. Doubt it will finish before my shift, if it is not I will continue running it on my faster dual core at home and should probably have full solution by morning. Otherwise if somebody has access to Mathematica on a faster computer feel free to run this code and report what you get.
Edited on July 30, 2010, 8:11 pm
update:
I found this website
http://www.mymathforum.com/viewtopic.php?f=40&t=13502
which shows a search for up to 10,000 giving only
4,6,10,28,772,1320,2620
so I have updated my search to start at the first prime after 10,000.
Edited on July 30, 2010, 8:57 pm

Posted by Daniel
on 20100730 20:06:11 