OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..400
EXAMPLE
a(4) = 17 because 17 is prime and 17 + prime(4) = 17 + 7 = 24 = 2^3*3 has 4 prime factors counted with multiplicity, and no smaller prime works.
MAPLE
g:= proc(n, N, pmax)
local Res, k, p;
if n = 0 then return [[]] fi;
Res:= NULL;
p:=1;
do
p:= nextprime(p);
if p >= pmax or 2^(n-1)*p > N then return [Res] fi;
for k from 1 to n while 2^(n-k)*p^k <= N do
Res:= Res, op(map(t -> [op(t), p$k], procname(n-k, N/p^k, p)));
od;
od;
end proc:
h:= (n, N) -> sort(map(convert, g(n, N, N/2^(n-1)+1), `*`)):
f:= proc(n) local pn, N, lastN, R, r;
pn:= ithprime(n);
N:= 2^n-1;
do
lastN:= N;
N:= 2*N;
R:= select(`>`, h(n, N), lastN);
for r in R do if r > pn and isprime(r-pn) then return r-pn fi od;
od;
end proc:
map(f, [$1..50]);
CROSSREFS
KEYWORD
nonn
AUTHOR
J. M. Bergot and Robert Israel, Mar 10 2020
STATUS
approved