OFFSET
0,3
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.
LINKS
FORMULA
a(2^k) = 2^k for any k >= 0.
a(2^k-1) = 2^k-1 for any k >= 0.
EXAMPLE
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.
PROG
(PARI) See Links section.
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Aug 22 2020
STATUS
approved