A335834 Sort the run lengths in binary expansion of n in ascending order (with multiplicities).
0, 1, 2, 3, 4, 5, 4, 7, 8, 11, 10, 11, 12, 11, 8, 15, 16, 23, 20, 19, 20, 21, 20, 23, 24, 19, 20, 19, 24, 23, 16, 31, 32, 47, 40, 39, 44, 43, 44, 39, 40, 43, 42, 43, 44, 43, 40, 47, 48, 39, 44, 51, 44, 43, 44, 39, 56, 39, 40, 39, 48, 47, 32, 63, 64, 95, 80, 79
Offset: 0
Examples
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.
Links
Programs
-
Mathematica
Array[FromDigits[Flatten@ MapIndexed[ConstantArray[Mod[First[#2], 2], #1] &, Sort[Length /@ Split[IntegerDigits[#, 2]]]], 2] &, 67] (* Michael De Vlieger, Jun 27 2020 *)
-
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))) }
Formula
a(a(n)) = a(n).
Comments