login
a(0) = 2; afterwards a(n) is the least prime greater than a(n-1) such that Omega(a(n-1) + a(n)) = n.
3

%I #28 Sep 25 2023 08:15:24

%S 2,3,7,11,13,19,197,251,389,1531,2053,3067,17669,25339,66821,105211,

%T 140549,318203,1008901,1940219,6710533,9804539,12215557,34970363,

%U 49964293,75864827,276456709,864393979,1350198533,2877659899,4101661957,7709498107,16449692933,51196041979

%N a(0) = 2; afterwards a(n) is the least prime greater than a(n-1) such that Omega(a(n-1) + a(n)) = n.

%H Robert Israel, <a href="/A357713/b357713.txt">Table of n, a(n) for n = 0..2500</a>

%e 2 + 3 = 5 (prime), 3 + 7 = 10 (semiprime), 7 + 11 = 18 (triprime).

%p f:= proc(n, a) # first prime b>a such that a+b is an n-almost-prime

%p uses priqueue;

%p local Aprimes, v, M, q, w;

%p M:= 10^100;

%p initialize(Aprimes);

%p insert([-2^n, 0, 2], Aprimes);

%p do

%p v:= extract(Aprimes);

%p if v[2] = n then

%p if -v[1] > 2*a and isprime(-v[1]-a) then return -v[1]-a fi

%p else

%p insert(v+[0, 1, 0], Aprimes);

%p q:= nextprime(v[3]);

%p w:= v[1]*(q/v[3])^(n-v[2]);

%p if w >= -M then insert([w, v[2], q], Aprimes) fi

%p fi

%p od

%p end proc:

%p R:= 2: a:= 2:

%p for n from 1 to 30 do

%p a:= f(n,a);

%p R:= R,a;

%p od:

%p R; # _Robert Israel_, Sep 19 2023

%t s = {p = 2}; Do[q = NextPrime[p]; While[k != PrimeOmega[p + q], q = NextPrime[q]]; AppendTo[s, p = q], {k, 30}]; s

%Y Cf. A001222 (Omega).

%K nonn

%O 0,1

%A _Zak Seidov_, Oct 10 2022