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.

A337304 a(n) is the greatest number m not yet in the sequence such that the binary expansions of n and of m have the same runs of consecutive equal digits (up to order but with multiplicity).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 12, 11, 14, 15, 16, 17, 20, 25, 18, 21, 26, 29, 24, 19, 22, 27, 28, 23, 30, 31, 32, 33, 40, 49, 36, 41, 52, 57, 34, 37, 42, 53, 50, 45, 58, 61, 48, 35, 44, 51, 38, 43, 54, 59, 56, 39, 46, 55, 60, 47, 62, 63, 64, 65, 80, 97
Offset: 0

Views

Author

Rémy Sigrist, Aug 22 2020

Keywords

Comments

This sequence has similarities with A337242; here we consider runs, there run lengths.
This sequence is a self-inverse permutation of the nonnegative integers.
This sequence preserves the Hamming weight (A000120), the number of binary digits (A070939) and the number of runs in binary expansions (A005811).

Examples

			For n = 303:
- the binary expansion of 43 is "100101111",
- the corresponding runs of consecutive equals digits are "1", "00", "1", "0", "1111",
- there are six numbers k with the same multiset of runs:
    k    bin(k)
    ---  -----------
    303  "100101111"
    317  "100111101"
    335  "101001111"
    377  "101111001"
    485  "111100101"
    489  "111101001"
- so a(303) = 489,
     a(317) = 485,
     a(335) = 377,
     a(377) = 335,
     a(485) = 317,
     a(489) = 303.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(2^k) = 2^k for any k >= 0.
a(2^k-1) = 2^k-1 for any k >= 0.