[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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