OFFSET
1,1
COMMENTS
The sequence is nondecreasing. - David A. Corneth, Jun 13 2025
EXAMPLE
The smallest number surrounded by semiprime numbers is 5 (between 4 and 6).
And 17 lies between 16 = 2^4 and 18 = 2*3^2.
MAPLE
F:= proc(n) local pq, t, x, y, z, p, i, m;
uses priqueue;
initialize(pq);
insert([-2^n, 2$n], pq);
y:= -infinity; z:= -infinity;
do
t:= extract(pq);
x:= -t[1];
if x-y=2 or x-z=2 then return x-1 fi;
z:= y; y:= x; m:= nops(t);
if t[-1] = 2 then insert([2*t[1], 2$m], pq) fi;
p:= nextprime(t[-1]);
for i from m to 2 by -1 while t[i] = t[-1] do
insert([t[1]*(p/t[-1])^(m+1-i), op(t[2..i-1]), p$(m+1-i)], pq)
od;
od
end proc:
seq(F(i), i=1..20); # Robert Israel, Jun 12 2025
PROG
(PARI) a(n) = my(m=2); while((bigomega(m-1)<n) || (bigomega(m+1)<n), m++); m; \\ Michel Marcus, Jun 13 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Sinuhe Perea, Jun 12 2025
EXTENSIONS
a(10)-a(13) from Alois P. Heinz, Jun 12 2025
a(14)-a(20) from Robert Israel, Jun 12 2025
More terms from David A. Corneth, Jun 13 2025
STATUS
approved
