OFFSET
1,2
COMMENTS
MAPLE
a:= proc(n) local i, p, q;
p, q:= 2, 3;
for i from 0 do
while nextprime(n*p) < (n*q) do
p, q:= q, nextprime(q)
od;
if not isprime(p+2) then return i fi;
p, q:= q, nextprime(q)
od
end:
seq(a(n), n=1..20); # Alois P. Heinz, Sep 20 2011
MATHEMATICA
a[n_] := a[n] = Module[{i, p = 2, q = 3}, For[i = 0, True, i++, While[NextPrime[n p] < n q, p = q; q = NextPrime[q]]; If[!PrimeQ[p+2], Return[i]]; p = q; q = NextPrime[q]]];
Array[a, 20] (* Jean-François Alcover, Nov 21 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Sep 19 2011
STATUS
approved