OFFSET
4,2
EXAMPLE
MATHEMATICA
Table[k = 1; While[k < ((Last@ # - First@ #)^2)/n, k++] &@ Block[{p = n + 1, q}, q = 2 n - p; While[q > 0 && Nand[PrimeQ@ p, PrimeQ@ q], p++; q--]; {p, q}]; k, {n, 4, 89}] (* or *)
Table[Ceiling[4 (n - #)^2/n] &@ Block[{p = n + 1, q}, q = 2 n - p; While[q > 0 && Nand[PrimeQ@ p, PrimeQ@ q], p++; q--]; p], {n, 4, 89}] (* Michael De Vlieger, Oct 26 2016, after T. D. Noe at A078587 and Michel Marcus PARI *)
PROG
(PARI) maxp(n) = {my(p = precprime(n-1)); while(!isprime(2*n-p), p = precprime(p-1)); p; }
a(n) = ceil(4*(n - maxp(n))^2/n); \\ Michel Marcus, Oct 22 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Oct 22 2016
STATUS
approved