%I #19 Dec 03 2016 12:24:44
%S 1,2,0,2,0,1,0,0,0,1,0,3,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,
%T 0,3,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,2,0,0,0,0,0,1,0,0,
%U 0,1,0,2,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0
%N a(n) = largest k such that n+1 = a prime, n+2 = 2 * a prime, ..., n+k is k times a prime, a(n) = 0 if n+1 is not a prime.
%C First 4 occurs at n=12720, first 5 occurs at n=19440. See A074200.
%H Antti Karttunen, <a href="/A278500/b278500.txt">Table of n, a(n) for n = 1..21000</a>
%e a(12) = 3 as 13 = 1*prime, 14 = 2*prime, 15 = 3*prime.
%t Table[If[CompositeQ[n + 1], 0, k = 1; While[Times @@ Boole@ Map[PrimeQ, MapIndexed[#1/First@ #2 &, (n + Range@ k)]] == 1, k++]; k - 1], {n, 120}] (* _Michael De Vlieger_, Dec 01 2016 *)
%o (PARI)
%o A278500(n) = { my(k=1); while((!((n+k)%k) && isprime((n+k)/k)), k = k+1); (k-1); }
%o for(n=1, 2^20, write("b278500.txt", n, " ", A278500(n)));
%o (Scheme) (define (A278500 n) (let loop ((k 1)) (let ((h (/ (+ n k) k))) (if (or (not (integer? h)) (zero? (A010051 h))) (- k 1) (loop (+ 1 k))))))
%Y Cf. A072668 (positions of zeros), A006093 (nonzeros), A089965 (positions of terms >= 2), A278583 (of terms >= 3), A278585 (of terms >= 4).
%Y Cf. A074200 (position of the first term >= n).
%K nonn
%O 1,2
%A _Antti Karttunen_, Nov 30 2016