%I #17 Mar 26 2018 19:52:15
%S 2,4,4,5,5,6,5,6,6,6,6,6,6,7,6,7,7,8,7,8,8,8,7,8,8,9,7,8,9,10,7,8,8,9,
%T 8,9,9,10,8,9,9,8,9,10,10,10,8,8,9,9,9,10,10,10,9,9,8,10,10,10,8,10,8,
%U 9,9,10,9,10,10,9,9,10,9,11,9,10,11,12,9,10,10,10,10,11,9,12,8,9,11,10,8,12
%N Greatest number of ones that can be used to write in binary representation 2*n as sum of two primes.
%C a(n) = Max{A000120(p)+A000120(q): p,q prime and p+q=2*n);
%C a(n) = A108423(n) + A108421(n).
%H Robert Israel, <a href="/A108422/b108422.txt">Table of n, a(n) for n = 2..10000</a>
%H <a href="/index/Go#Goldbach">Index entries for sequences related to Goldbach conjecture</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%p N:= 200: # to get a(2)..a(N)
%p Primes:= select(isprime, [seq(i, i=3..2*N-3, 2)]):
%p Ones:= map(t -> convert(convert(t, base, 2), `+`), Primes):
%p V:= Vector(N): V[2]:= 2:
%p for i from 1 to nops(Primes) do
%p p:= Primes[i];
%p for j from 1 to i do
%p k:= (p+Primes[j])/2;
%p if k > N then break fi;
%p t:= Ones[i]+Ones[j];
%p if t > V[k] then V[k]:= t fi
%p od
%p od:
%p convert(V[2..N], list); # _Robert Israel_, Mar 26 2018
%Y Cf. A004676, A005843, A007088, A108421.
%K nonn,base
%O 2,1
%A _Reinhard Zumkeller_, Jun 03 2005
|