login
A245715
Least number k > 0 such that n - k! is prime, or 0 if no such k exists.
3
0, 0, 1, 1, 2, 1, 2, 1, 2, 0, 3, 1, 2, 1, 2, 0, 3, 1, 2, 1, 2, 0, 3, 1, 2, 4, 4, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 0, 4, 1, 2, 1, 2, 0, 3, 1, 2, 0, 0, 0, 3, 1, 2, 0, 0, 0, 3, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 0, 4, 1, 2, 1, 2, 0, 3, 0, 3, 1, 2, 0, 4, 1, 2, 0, 0, 0, 3, 1, 2, 0, 0, 0, 3, 0, 4, 1, 2, 0, 0, 1, 2, 1, 2, 0, 3, 1, 2, 1, 2, 0, 3, 1, 2, 0, 0, 0, 3
OFFSET
1,5
COMMENTS
a(n)! < n for all n. Thus a(n) = 0 is definite.
LINKS
EXAMPLE
11 - 1! = 10 is not prime.
11 - 2! = 9 is not prime.
11 - 3! = 5 is prime. Thus a(11) = 3.
PROG
(PARI)
a(n)=for(k=1, n, if(ispseudoprime(n-k!), return(k)))
vector(150, n, a(n))
CROSSREFS
Sequence in context: A274820 A230583 A197366 * A337736 A047885 A072731
KEYWORD
nonn
AUTHOR
Derek Orr, Jul 30 2014
STATUS
approved