OFFSET
1,1
COMMENTS
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..292 (all terms up to 10 million)
EXAMPLE
5 is sandwiched between two semiprimes 4 = 2*2 and 6 = 3*2, one of which is a square. Thus, 5 is in this sequence.
34 is sandwiched between squarefree semiprimes 33 = 3*11 and 35 = 5*7. Thus, 34 is not in this sequence.
MATHEMATICA
Select[Range[100000], Total[Transpose[FactorInteger[# - 1]][[2]]] == 2 && Total[Transpose[FactorInteger[# + 1]][[2]]] == 2 && ! (Transpose[FactorInteger[# - 1]][[2]] == {1, 1} && Transpose[FactorInteger[# + 1]][[2]] == {1, 1}) &]
Mean/@Select[SequencePosition[PrimeOmega[Range[80000]], {2, _, 2}], AnyTrue[Sqrt[#], IntegerQ]&] (* Harvey P. Dale, Jun 14 2023 *)
PROG
(Python)
from sympy import factorint
from itertools import count, islice
def agen(): # generator of terms
nxt = []
yield 5
for k in count(6, 2):
prv, nxt = nxt, list(factorint(k+1).values())
if (prv==[1, 1] and nxt==[2]) or (prv==[2] and nxt==[1, 1]): yield k
print(list(islice(agen(), 44))) # Michael S. Branicky, Nov 26 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Tanya Khovanova, Nov 26 2022
STATUS
approved