OFFSET
1,4
EXAMPLE
Let n=22, then 2*prime(22) = 2*79 = 158. We have 158-1=157, 158-4=154, 158-9=149, 158-16=142, and only the last number is semiprime. So a(22)=4.
PROG
(PARI) a(n) = {k = 1; while ((v = 2*prime(n) - k^2) && (v > 0) && (bigomega(v) != 2), k++); if (v <= 0, 0, k); } \\ Michel Marcus, Apr 25 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Apr 25 2014
EXTENSIONS
More terms from Michel Marcus, Apr 25 2014
STATUS
approved