OFFSET
2,9
LINKS
R. Mestrovic, Euclid's theorem on the infinitude of primes: a historical survey of its proofs (300 BC--2012) and another new proof, arXiv preprint arXiv:1202.3670 [math.HO], 2012-2018.
EXAMPLE
P(2)/2-2^0=2 is prime, so a(2)=0;
P(10)/2-2^3=3234846607 is Prime, so a(10)=3.
MATHEMATICA
nmax = 2^8192; npd = 1; n = 2; npd = npd*Prime[n]; While[npd < nmax, tn = 1; tt = 2; cp = npd - tt; While[(cp > 1) && (! (PrimeQ[cp])), tn = tn + 1; tt = tt*2; cp = npd - tt]; If[cp < 2, Print["*"], Print[tn]]; n = n + 1; npd = npd*Prime[n]]
(* Second program: *)
k = 1; a = {}; Do[k = k*Prime[n]; m = 1; While[ ! PrimeQ[k - 2^m], m++ ]; Print[m]; AppendTo[a, m], {n, 2, 200}]; a (* Artur Jasinski, Apr 21 2008 *)
PROG
(PARI) a(n)=my(t=prod(i=2, n, prime(i)), m); while(!isprime(t-2^m), m++); m \\ Charles R Greathouse IV, Apr 28 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Lei Zhou, Feb 15 2005
EXTENSIONS
Edited by N. J. A. Sloane, May 16 2008 at the suggestion of R. J. Mathar
STATUS
approved