OFFSET
2,1
COMMENTS
This is the second sequence of the series of ones defined in A283267.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 2..10000
EXAMPLE
a(2) = 4 since prime(2)^2 = 3^2 = 9; 6 < 9 < 10, 6 = 2*3 and 10 = 2*5; 10 - 6 = 4. The number prime(1)^2 = 2^2 = 4 is the smallest semiprime, therefore the offset of the sequence is 2 since there are no positive semiprimes less than 4.
MATHEMATICA
Table[Module[{m = Prime[n]^2, a, b}, a = m - 1; b = m + 1; While[PrimeOmega@ a != 2, a--]; While[PrimeOmega@ b != 2, b++]; b - a], {n, 2, 120}] (* Michael De Vlieger, Mar 04 2017 *)
PROG
(PARI) issemi(n)=bigomega(n)==2
a(n, p=prime(n))=my(a=p^2, b=a); while(!issemi(a--), ); while(!issemi(b++), ); b-a \\ Charles R Greathouse IV, Mar 06 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Mar 04 2017
EXTENSIONS
More terms from Peter J. C. Moses, Mar 04 2017
STATUS
approved