login
Least number k such that (k! + n)/k is prime, or 0 if no such k exists.
4

%I #15 Aug 03 2014 23:24:41

%S 1,1,3,1,0,1,0,2,3,1,0,1,0,0,3,1,0,1,0,2,0,1,0,2,5,0,3,1,0,1,0,2,3,0,

%T 5,1,0,38,0,1,0,1,0,2,3,1,0,0,7,0,3,1,0,0,0,2,0,1,0,1,0,0,3,0,5,1,0,4,

%U 0,1,0,1,0,74,0,0,0,1,0,2,3,1,0,2,5,0,3

%N Least number k such that (k! + n)/k is prime, or 0 if no such k exists.

%C If a(n) = n, then n is in A090660.

%C a(n) <= n for all n.

%C a(n) = 1 if and only if n + 1 is prime.

%H Jens Kruse Andersen, <a href="/A245756/b245756.txt">Table of n, a(n) for n = 1..1000</a>

%e (1! + 3)/1 = 4 is not prime.

%e (2! + 3)/2 = 5/2 is not prime.

%e (3! + 3)/3 = 3 is prime. Thus a(3) = 3.

%o (PARI)

%o a(n)=for(k=1,n,s=(k!+n)/k;if(floor(s)==s,if(ispseudoprime(s),return(k))))

%o n=1;while(n<150,print1(a(n),", ");n++)

%Y Cf. A090660.

%K nonn

%O 1,3

%A _Derek Orr_, Jul 31 2014

%E Corrected by _Jens Kruse Andersen_, Aug 03 2014