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”).

Least number k such that k!/n is prime, or 0 if no such number exists.
2

%I #17 Aug 18 2014 08:20:39

%S 2,3,3,0,0,0,0,4,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,

%T 0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

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

%C a(n) <= n + 2 for all n > 0.

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

%e a(3) = 3 because 3!/3 = 6/3 = 2, which is prime.

%e a(4) = 0 because there is no k such that k!/4 is a prime. For all k > 3, k! has 24 as a divisor, so therefore k!/4 has 6 as a divisor and is therefore certainly composite.

%p N:= 7: # to get all a(n) for n <= N!

%p A:= Array(1..N!):

%p for k from 1 to N do

%p for p in select(isprime,[$2..k]) do

%p if A[k!/p] = 0 then A[k!/p]:= k fi

%p od

%p od:

%p seq(A[n],n=1..N!); # _Robert Israel_, Aug 18 2014

%o (PARI)

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

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

%Y Cf. A242456.

%K nonn

%O 1,1

%A _Derek Orr_, Aug 16 2014