OFFSET
0,3
COMMENTS
LINKS
FORMULA
a(a(n)) = a(n).
EXAMPLE
For n = 72:
- the binary representation of 72 is "1001000",
- the corresponding run lengths are: 1, 2, 1, 3,
- in ascending order: 1, 1, 2, 3,
- so the binary representation of a(72) is "1011000",
- and a(72) = 88.
MATHEMATICA
Array[FromDigits[Flatten@ MapIndexed[ConstantArray[Mod[First[#2], 2], #1] &, Sort[Length /@ Split[IntegerDigits[#, 2]]]], 2] &, 67] (* Michael De Vlieger, Jun 27 2020 *)
PROG
(PARI) torl(n) = { my (rr=[]); while (n, my (r=valuation(n+(n%2), 2)); rr = concat(r, rr); n\=2^r); rr }
fromrl(rr) = { my (v=0); for (k=1, #rr, v = (v+(k%2))*2^rr[k]-(k%2)); v }
a(n) = { fromrl(vecsort(torl(n))) }
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Jun 26 2020
STATUS
approved