%I #31 Mar 04 2018 23:42:36
%S 6,10,26,90,88,84,82,200,282,280,522,518,516,512,942,936,934,928,924,
%T 922,2566,2562,2556,2548,2544,2542,5268,5266,5262,5248,5244,5238,5236,
%U 7280,7278,7272,7266,7262,7256,43356,43354,43344,43342,43338,43336,43324,54024
%N a(n) = s(n) - prime(n+1)+3, where s(n) = smallest even number x > prime(n) such that the difference x-p is composite for all primes p <= prime(n).
%C The statement "a(n) >= 0 for n >= 1" is equivalent to Goldbach's conjecture (cf. Phong, Dongdong, 2004, Theorem (a)).
%C Records: 6, 10, 26, 90, 200, 282, 522, 942, 2566, 5268, 7280, 43356, 54024, ..., . - _Robert G. Wilson v_, Feb 28 2018
%H Robert G. Wilson v, <a href="/A298736/b298736.txt">Table of n, a(n) for n = 1..1205</a>
%H Bui Minh Phong and Li Dongdong, <a href="http://emis.matem.unam.mx/journals/AMI/2004.htm">Elementary problems which are equivalent to the Goldbach's Conjecture</a>, Acta Academiae Paedagogicae Agriensis, Sectio Mathematicae 31 (2004) 33-37.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Goldbach%27s_conjecture">Goldbach's conjecture</a>
%H <a href="/index/Go#Goldbach">Index entries for sequences related to Goldbach conjecture</a>
%F a(n) = A152522(n)-A000040(n+1)+3 for n > 0.
%p N:= 100: # to get a(1)..a(N)
%p P:= [seq(ithprime(i),i=1..N+1)]:
%p s:= proc(n,k0) local k;
%p for k from max(k0,P[n]+1) by 2 do
%p if andmap(not(isprime), map(t -> k - t, P[1..n])) then return k
%p fi
%p od
%p end proc:
%p K[1]:= 6: A[1]:= 6:
%p for n from 2 to N do
%p K[n]:= s(n,K[n-1]);
%p A[n]:= K[n]- P[n+1]+3;
%p od:
%p seq(A[n],n=1..N); # _Robert Israel_, Mar 01 2018
%t f[n_] := Block[{k, x = 2, q = Prime@ Range@ n}, x += Mod[x, 2]; While[k = 1; While[k < n +1 && CompositeQ[x - q[[k]]], k++]; k < n +1, z = x += 2]; x - Prime[n +1] +3]; Array[f, 47] (* _Robert G. Wilson v_, Feb 26 2018 *)
%o (PARI) s(n) = my(p=prime(n), x); if(p==2, x=4, x=p+1); while(1, forprime(q=1, p, if(ispseudoprime(x-q), break, if(q==p, return(x)))); x=x+2)
%o a(n) = s(n)-prime(n+1)+3
%Y Cf. A000040, A082467, A152522, A242165.
%K look,nonn
%O 1,1
%A _Felix Fröhlich_, Jan 25 2018