OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
n=1: nextprime(1)=2, nextsemiprime(1)=4, hence a(1)=2,
n=2: nextprime(2)=3, nextsemiprime(2)=4, hence a(2)=3,
n=3: nextprime(3)=5, nextsemiprime(3)=4, hence a(3)=4.
MAPLE
PS:= select(t -> numtheory:-bigomega(t)<=2, [$2..500]):
Res:= NULL:
k:= 1;
for n from 2 to max(PS) do
if n > PS[k] then k:= k+1 fi;
Res:= Res, PS[k];
od:
Res; # Robert Israel, Oct 25 2017
MATHEMATICA
Table[m=n+1; While[2!= Plus@@Last/@FactorInteger[m], m++]; Min[NextPrime[n], m], {n, 200}]
mnp[n_]:=Module[{s=n+1}, While[PrimeOmega[s]!=2, s++]; Min[NextPrime[n], s]]; Array[mnp, 100] (* Harvey P. Dale, Apr 23 2019 *)
PROG
(PARI) {for(n=1, 200, m=n+1; while(2<>bigomega(m), m++); print(min(nextprime(n+1), m)))}
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Jan 08 2011
STATUS
approved