login
a(n) is the first semiprime k such that there are as many semiprimes as possible in the n numbers starting at k.
0

%I #7 Jan 12 2024 22:46:59

%S 4,9,33,33,91,118,213,213,213,213,143095,143095,10496839,237520705,

%T 10630829,7225144283,54712989442,54712989442

%N a(n) is the first semiprime k such that there are as many semiprimes as possible in the n numbers starting at k.

%e For n = 5, there are at most 4 semiprimes in 5 consecutive numbers (because at least one of the 5 is divisible by 4). In the 5 consecutive numbers starting at 91 there are 4 semiprimes: 91 = 7 * 13, 93 = 3 * 31, 94 = 2 * 47 and 95 = 5 * 19, and no semiprime < 91 works, so a(5) = 91.

%p f:= proc(n)

%p local P,r,T,M,v,t,V,W,m,Ts,k,x,L,p,i;

%p P:= map(p -> `if`(p^2 <= n, p^2,p),select(isprime, [$1..n/2]));

%p r:= ilcm(P);

%p T:= combinat:-cartprod([seq([$0..p-1],p=P)]);

%p M:= 0;

%p while not T[finished] do

%p v:= T[nextvalue]();

%p t:= chrem(v,P);

%p V:= [seq(igcd(t+i,r),i=0..n-1)];

%p if V[1] <> 1 and not isprime(V[1]) then next fi;

%p W[t]:= select(i -> V[i] = 1 or isprime(V[i]), [$1..n]);

%p m:= nops(W[t]);

%p if m > M then

%p M:= m; Ts:= {t};

%p elif m = M then Ts:= Ts union {t}

%p fi

%p od:

%p for k from 0 do

%p for v in Ts do

%p x:= k*r + v;

%p L:= W[v] +~ (x-1);

%p if andmap(t -> numtheory:-bigomega(t) = 2, L) then return x fi;

%p od;

%p od:

%p end proc:

%p 4,9,33, seq(f(n),n=4..17);

%Y Cf. A001358.

%K nonn,more

%O 1,1

%A _Robert Israel_, Jan 02 2024