login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A293576 Numbers n such that the set of exponents in expression for 2*n as a sum of distinct powers of 2 can be partitioned into two parts with equal sums. 2

%I #9 Oct 22 2017 15:22:09

%S 0,7,13,15,22,25,27,30,39,42,45,47,49,51,54,59,60,62,75,76,82,85,87,

%T 90,93,95,97,99,102,107,108,110,117,119,120,122,125,127,141,143,147,

%U 148,153,155,158,162,165,167,170,173,175,179,180,185,187,188,190,193

%N Numbers n such that the set of exponents in expression for 2*n as a sum of distinct powers of 2 can be partitioned into two parts with equal sums.

%C More informally, this sequence encodes finite sets of positive numbers, say { e_1, e_2, ..., e_h }, such that +- e_1 +- e_2 ... +- e_h = 0 has a solution.

%C The set of exponents in expression for n as a sum of distinct powers of 2 corresponds to the n-th row of A133457.

%C No term can have a Hamming weight of 1 or 2.

%C If x and y belong to this sequence and x AND y = 0 (where AND stands for the bitwise and-operator), then x + y belongs to this sequence.

%C If k has an odd Hamming weight, then there are only a finite number of terms with the same odd part as k (see A000265 for the odd part of a number).

%C The number 2^k-1 belongs to this sequence iff A063865(k) > 0.

%C If k has Hamming weight > 1, then k + 2^(A029931(k)-1) belongs to this sequence.

%H Alois P. Heinz, <a href="/A293576/b293576.txt">Table of n, a(n) for n = 1..20000</a>

%e 2*42 = 2^6 + 2^4 + 2^2 and 6 = 4 + 2, hence 42 appears in the sequence.

%e 2*11 = 2^4 + 2^2 + 2^1 and { 1, 2, 4 } cannot be partitioned into two parts with equals sums, hence 11 does not appear in the sequence.

%p b:= proc(n, t) option remember; `if`(n=0, is(t=0),

%p (i-> b(n-2^i, t-i) or b(n-2^i, t+i))(ilog2(n)))

%p end:

%p a:= proc(n) option remember; local k; for k from 1+

%p `if`(n=1, -1, a(n-1)) while not b(2*k, 0) do od; k

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Oct 22 2017

%o (PARI) is(n) = { my (v=Set(0)); my (b = Vecrev(binary(n))); for (i=1, #b, if (b[i], v = set union(Set(vector(#v, k, v[k]-i)), Set(vector(#v, k, v[k]+i))););); return (set search(v,0)); }

%Y Cf. A000120, A000265, A029931, A133457, A293664.

%K nonn,base

%O 1,2

%A _Rémy Sigrist_, Oct 12 2017

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)