This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A241423 #25 Jul 27 2020 04:44:41 %S A241423 1,2,1,4,1,6,0,2,1,10,1,6,0,2,1,11,1,14,0,2,1,16,0,3,0,2,1,20,1,22,0, %T A241423 0,0,4,1,33,0,2,1,25,1,38,0,2,1,44,0,6,0,2,1,52,0,4,0,2,1,27,1,50,0,0, %U A241423 0,4,1,64,0,2,1,55,1,67,0,0,0,6,1,73,0,2,1,68,0,4,0,2,1,52,0,6 %N A241423 Largest number k > 0 such that n + k! is prime, or 0 if no such k exists. %C A241423 If k >= n, then n + k! is divisible by n and is not prime. %C A241423 a(n) < A020639(n), because if prime p divides n then p divides n + k! for k >= p. - _Robert Israel_, Aug 10 2014 %C A241423 There is no term for n = 1 since factorial primes 1 + k! can probably be arbitrarily large (A002981 shows k values). - _Jens Kruse Andersen_, Aug 13 2014 %H A241423 Jens Kruse Andersen, <a href="/A241423/b241423.txt">Table of n, a(n) for n = 2..1000</a> %p A241423 a:= proc(n) %p A241423 local k; %p A241423 for k from min(numtheory:-factorset(n)) to 1 by -1 do %p A241423 if isprime(n+k!) then return(k) fi %p A241423 od: %p A241423 0 %p A241423 end proc: %p A241423 seq(a(n),n=2..100); # _Robert Israel_, Aug 10 2014 %t A241423 a[n_] := Module[{k}, For[k = FactorInteger[n][[1, 1]], k >= 1, k--, If[PrimeQ[n + k!], Return[k]]]; 0]; %t A241423 a /@ Range[2, 100] (* _Jean-François Alcover_, Jul 27 2020, after Maple *) %o A241423 (PARI) %o A241423 a(n)=forstep(k=n,1,-1,if(ispseudoprime(n+k!),return(k))) %o A241423 n=2;while(n<150,print1(a(n),", ");n++) %Y A241423 Cf. A245714, A125162. %K A241423 nonn %O A241423 2,2 %A A241423 _Derek Orr_, Aug 08 2014