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.

A352785 Numbers k such that w(k - w(k)) = w(k), where w(k) is the binary weight of k, A000120(k).

Original entry on oeis.org

0, 2, 5, 12, 14, 20, 22, 25, 27, 28, 36, 38, 41, 43, 44, 52, 57, 58, 68, 70, 73, 75, 76, 84, 89, 90, 100, 105, 106, 115, 120, 122, 125, 132, 134, 137, 139, 140, 148, 153, 154, 164, 169, 170, 179, 184, 186, 189, 196, 201, 202, 211, 216, 218, 221, 232, 234, 237, 241, 243, 249, 252, 254, 260, 262, 265, 267, 268, 276
Offset: 1

Views

Author

Ctibor O. Zizka, Apr 02 2022

Keywords

Examples

			k = 20; A000120(20 - A000120(20)) = A000120(20), thus k = 20 is a term.
		

Crossrefs

Programs

  • Maple
    q:= n-> (w-> w(n-w(n))=w(n))(k-> add(i, i=Bits[Split](k))):
    select(q, [$0..300])[];  # Alois P. Heinz, May 24 2022
  • Mathematica
    w[n_] := DigitCount[n, 2, 1]; Select[Range[0, 300], w[# - w[#]] == w[#] &] (* Amiram Eldar, Apr 02 2022 *)
  • Python
    def w(n): return bin(n).count("1")
    def ok(n): wn = w(n); return w(n - wn) == wn
    print([k for k in range(277) if ok(k)]) # Michael S. Branicky, Apr 02 2022

Formula

k : A000120(A011371(k)) = A000120(k); A352784(k) = A000120(k).