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 #18 Feb 10 2019 18:58:10
%S 2,2,3,11,19,31,79,211,607,1931,6337,21961,78919,295291,1143563,
%T 4574149,18859777,80014843,348776611,1559776279,7147792903,
%U 33526120129,160785623729,787685471519,3938427356629,20082117944579,104349745809137,552166953567737
%N a(n) is the smallest prime x such that x^2-n! is also prime.
%C Every prime > 3 in this sequence is bigger than the n-th prime, see comment to A121926. For the smallest number x such that x^2-n! is prime see A143931. For the smallest prime numbers of the form x^2-n! see A143932.
%H Robert Israel, <a href="/A143933/b143933.txt">Table of n, a(n) for n = 1..300</a>
%p f:= proc(n) local p,t;
%p t:= n!;
%p p:= floor(sqrt(t));
%p do
%p p:= nextprime(p);
%p if isprime(p^2-t) then return p fi
%p od
%p end proc:
%p map(f, [$1..28]); # _Robert Israel_, Feb 10 2019
%t f[n_] := Block[{p = NextPrime[ Sqrt[ n!]]}, While[ !PrimeQ[p^2 - n!], p = NextPrime@ p]; p]; Array[f, 27] (* _Robert G. Wilson v_, Jan 08 2015 *)
%o (PARI) a(n)=my(N=n!,x=sqrtint(N)+1); while(!isprime(x^2-N), x=nextprime(x+1)); x \\ _Charles R Greathouse IV_, Dec 09 2014
%Y Cf. A121926, A143931, A143932.
%K nonn
%O 1,1
%A _Artur Jasinski_, Sep 05 2008
%E Corrected by _Charles R Greathouse IV_, Dec 09 2014