OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1) = 12 because 12th semiprime = 2*17, 2*17-1 = 3*11 and 2*17+1 = 5*7;
a(2) = 29 because 29th semiprime = 2*43, 2*43-1 = 5*17 and 2*43+1 = 3*29.
MATHEMATICA
Flatten[Position[Select[Range[7000], PrimeOmega[#]==2&], _?(PrimeOmega[#-1] == PrimeOmega[#+1]==2&)]] (* Harvey P. Dale, Dec 18 2012 *)
PROG
(Python)
from sympy import factorint
from itertools import count, islice
def semiprimes():
for i in count(1):
if sum(factorint(i).values()) == 2:
yield i
def agen():
g = semiprimes()
prevsp, sp, nextsp = next(g), next(g), next(g)
for k in count(2):
if nextsp - prevsp == 2:
yield k
prevsp, sp, nextsp = sp, nextsp, next(g)
print(list(islice(agen(), 51))) # Michael S. Branicky, Dec 29 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Juri-Stepan Gerasimov, Mar 25 2010
EXTENSIONS
Corrected by Ray Chandler, Apr 06 2010
STATUS
approved