%I #46 Mar 10 2020 23:32:20
%S 3,3,3,17,37,83,271,557,1129,2531,2017,21467,28631,24533,73681,98251,
%T 196549,589763,524221,2621369,5242807,14155697,69205933,16777127,
%U 83885983,67108763,1543503769,1006632853,1342177171,3623878543,11811159937,54358179709,32212254583,225485782901,260919263083
%N a(n) is the least prime p such that p+prime(n) has exactly n prime factors, counted with multiplicity.
%H Robert Israel, <a href="/A332860/b332860.txt">Table of n, a(n) for n = 1..400</a>
%F A001222(a(n)+A000040(n)) = n.
%e 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.
%p g:= proc(n, N, pmax)
%p local Res, k, p;
%p if n = 0 then return [[]] fi;
%p Res:= NULL;
%p p:=1;
%p do
%p p:= nextprime(p);
%p if p >= pmax or 2^(n-1)*p > N then return [Res] fi;
%p for k from 1 to n while 2^(n-k)*p^k <= N do
%p Res:= Res, op(map(t -> [op(t),p$k], procname(n-k,N/p^k,p)));
%p od;
%p od;
%p end proc:
%p h:= (n,N) -> sort(map(convert,g(n,N,N/2^(n-1)+1),`*`)):
%p f:= proc(n) local pn, N, lastN, R, r;
%p pn:= ithprime(n);
%p N:= 2^n-1;
%p do
%p lastN:= N;
%p N:= 2*N;
%p R:= select(`>`,h(n,N), lastN);
%p for r in R do if r > pn and isprime(r-pn) then return r-pn fi od;
%p od;
%p end proc:
%p map(f, [$1..50]);
%Y Cf. A000040, A001222.
%K nonn
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Mar 10 2020