A365278 In the binary expansion of n replace each run of k consecutive 1's by the decimal digits of A007931(k) to get the ternary expansion of a(n).
0, 1, 3, 2, 9, 10, 6, 4, 27, 28, 30, 11, 18, 19, 12, 5, 81, 82, 84, 29, 90, 91, 33, 31, 54, 55, 57, 20, 36, 37, 15, 7, 243, 244, 246, 83, 252, 253, 87, 85, 270, 271, 273, 92, 99, 100, 93, 32, 162, 163, 165, 56, 171, 172, 60, 58, 108, 109, 111, 38, 45, 46, 21
Offset: 0
Examples
The binary expansion of 415 is "110011111", A007931(2) = 2 and A007931(5) = 21, so the ternary expansion of a(415) is "20021", and a(415) = 169.
Links
Programs
-
Mathematica
A007931[n_]:=Rest[IntegerDigits[n+1,2]]+1; A365278[n_]:=FromDigits[Flatten[Map[If[First[#]==1,A007931[Length[#]],#]&,Split[IntegerDigits[n,2]]]],3]; Array[A365278,100,0] (* Paolo Xausa, Oct 17 2023 *)
-
PARI
See Links section.
Comments