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”).
%I #13 Aug 05 2014 02:33:48
%S 0,0,0,4,5,0,7,8,0,0,0,4,13,0,15,4,0,0,0,0,0,0,0,0,5,0,0,0,0,0,31,0,
%T 33,34,5,0,0,0,39,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5,
%U 6,0,0,0,0,0,0,0,0,0,0,7,6,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5
%N Least number k such that (k!-n)/k is prime, or 0 if no such k exists.
%C For a(n) > 0, a(n) is a divisor of n.
%C If a(n) = n, then n - 1 is in A002982.
%H Jens Kruse Andersen, <a href="/A240160/b240160.txt">Table of n, a(n) for n = 1..2500</a>
%o (PARI)
%o a(n)=for(k=1,n,s=(k!-n)/k;if(floor(s)==s,if(ispseudoprime(s),return(k))))
%o vector(150, n, a(n))
%Y Cf. A002982, A240161, A245756.
%K nonn
%O 1,4
%A _Derek Orr_, Aug 01 2014
%E Typo in PARI code fixed by _Colin Barker_, Aug 02 2014