login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A108421 Smallest number of ones needed to write in binary representation 2*n as sum of two primes. 3

%I

%S 2,4,4,4,5,5,5,5,4,4,5,6,5,5,6,4,5,6,5,5,5,5,6,6,6,5,6,5,6,7,7,7,8,5,

%T 5,6,5,5,6,6,5,6,6,5,6,6,7,8,5,5,6,6,6,6,7,5,6,6,7,8,7,7,8,6,7,5,5,6,

%U 5,5,6,6,5,6,6,5,6,7,7,7,6,6,6,6,6,6,7,6,6,7,7,7,8,7,8,6,5,5,6,6,6,6,7,5,6

%N Smallest number of ones needed to write in binary representation 2*n as sum of two primes.

%C a(n) = Min{A000120(p)+A000120(q): p,q prime and p+q=2*n);

%C a(n) = A108422(n) - A108423(n).

%C a(n) >= A000120(n)+1, with equality for n in A241757. - _Robert Israel_, Mar 25 2018

%H Robert Israel, <a href="/A108421/b108421.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>

%e n=15: 2*15=30 and A002375(15)=3 with 30=7+23=11+19=13+17,

%e 13+17 -> 1101+10001 needs a(15)=5 binary ones, whereas

%e 7+23 -> 111+10111 and 11+19 -> 1011+10011 need more.

%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 V[k] = 0 or t < V[k] then V[k]:= t fi

%p od

%p od:

%p convert(V[2..N],list); # _Robert Israel_, Mar 25 2018

%t Min[#]&/@(Table[Total[Flatten[IntegerDigits[#,2]]]&/@Select[ IntegerPartitions[ 2*n,{2}],AllTrue[#,PrimeQ]&],{n,2,110}]) (* _Harvey P. Dale_, Jul 27 2020 *)

%Y Cf. A000120, A004676, A005843, A007088, A108422, A108423, A241757.

%K nonn,base

%O 2,1

%A _Reinhard Zumkeller_, Jun 03 2005

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 14 19:28 EDT 2021. Contains 345038 sequences. (Running on oeis4.)