login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,5

COMMENTS

a(n)! < n for all n. Thus a(n) = 0 is definite.

LINKS

Jens Kruse Andersen, Table of n, a(n) for n = 1..10000

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

Adjacent sequences:  A245712 A245713 A245714 * A245716 A245717 A245718

KEYWORD

nonn

AUTHOR

Derek Orr, Jul 30 2014

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 28 18:02 EST 2022. Contains 350657 sequences. (Running on oeis4.)