

A241423


Largest number k > 0 such that n + k! is prime, or 0 if no such k exists.


2



1, 2, 1, 4, 1, 6, 0, 2, 1, 10, 1, 6, 0, 2, 1, 11, 1, 14, 0, 2, 1, 16, 0, 3, 0, 2, 1, 20, 1, 22, 0, 0, 0, 4, 1, 33, 0, 2, 1, 25, 1, 38, 0, 2, 1, 44, 0, 6, 0, 2, 1, 52, 0, 4, 0, 2, 1, 27, 1, 50, 0, 0, 0, 4, 1, 64, 0, 2, 1, 55, 1, 67, 0, 0, 0, 6, 1, 73, 0, 2, 1, 68, 0, 4, 0, 2, 1, 52, 0, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

2,2


COMMENTS

If k >= n, then n + k! is divisible by n and is not prime.
a(n) < A020639(n), because if prime p divides n then p divides n + k! for k >= p.  Robert Israel, Aug 10 2014
There is no term for n = 1 since factorial primes 1 + k! can probably be arbitrarily large (A002981 shows k values).  Jens Kruse Andersen, Aug 13 2014


LINKS

Jens Kruse Andersen, Table of n, a(n) for n = 2..1000


MAPLE

a:= proc(n)
local k;
for k from min(numtheory:factorset(n)) to 1 by 1 do
if isprime(n+k!) then return(k) fi
od:
0
end proc:
seq(a(n), n=2..100); # Robert Israel, Aug 10 2014


PROG

(PARI)
a(n)=forstep(k=n, 1, 1, if(ispseudoprime(n+k!), return(k)))
n=2; while(n<150, print1(a(n), ", "); n++)


CROSSREFS

Cf. A245714, A125162.
Sequence in context: A216952 A114326 A308175 * A323244 A329642 A214052
Adjacent sequences: A241420 A241421 A241422 * A241424 A241425 A241426


KEYWORD

nonn


AUTHOR

Derek Orr, Aug 08 2014


STATUS

approved



