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

%I #10 Jul 30 2014 20:25:39

%S 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,

%T 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,

%U 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

%N Least number k > 0 such that n - k! is prime, or 0 if no such k exists.

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

%H Jens Kruse Andersen, <a href="/A245715/b245715.txt">Table of n, a(n) for n = 1..10000</a>

%e 11 - 1! = 10 is not prime.

%e 11 - 2! = 9 is not prime.

%e 11 - 3! = 5 is prime. Thus a(11) = 3.

%o (PARI)

%o a(n)=for(k=1,n,if(ispseudoprime(n-k!),return(k)))

%o vector(150,n,a(n))

%K nonn

%O 1,5

%A _Derek Orr_, Jul 30 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 00:26 EDT 2024. Contains 371264 sequences. (Running on oeis4.)