cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

0, 7, 13, 15, 22, 25, 27, 30, 39, 42, 45, 47, 49, 51, 54, 59, 60, 62, 75, 76, 82, 85, 87, 90, 93, 95, 97, 99, 102, 107, 108, 110, 117, 119, 120, 122, 125, 127, 141, 143, 147, 148, 153, 155, 158, 162, 165, 167, 170, 173, 175, 179, 180, 185, 187, 188, 190, 193
Offset: 1

Views

Author

Rémy Sigrist, Oct 12 2017

Keywords

Comments

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.
The set of exponents in expression for n as a sum of distinct powers of 2 corresponds to the n-th row of A133457.
No term can have a Hamming weight of 1 or 2.
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.
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).
The number 2^k-1 belongs to this sequence iff A063865(k) > 0.
If k has Hamming weight > 1, then k + 2^(A029931(k)-1) belongs to this sequence.

Examples

			2*42 = 2^6 + 2^4 + 2^2 and 6 = 4 + 2, hence 42 appears in the sequence.
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.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, t) option remember; `if`(n=0, is(t=0),
          (i-> b(n-2^i, t-i) or b(n-2^i, t+i))(ilog2(n)))
        end:
    a:= proc(n) option remember; local k; for k from 1+
         `if`(n=1, -1, a(n-1)) while not b(2*k, 0) do od; k
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Oct 22 2017
  • 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)); }