login
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).
3

%I #21 Oct 17 2023 10:54:59

%S 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,

%T 55,57,20,36,37,15,7,243,244,246,83,252,253,87,85,270,271,273,92,99,

%U 100,93,32,162,163,165,56,171,172,60,58,108,109,111,38,45,46,21

%N 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).

%C This sequence is a permutation of the nonnegative integers with inverse A365279.

%C For any pair (b, c) of bases >= 2, we can devise a similar sequence, say F_{b, c}:

%C - for any d >= 2, let Z_d be the set of zeroless numbers in base d,

%C - in the base b expansion of n replace each run of consecutive nonzero digits (say corresponding to Z_b(k) for some k > 0) by the base c digits of Z_c(k) to get the base c expansion of F_{b, c}(n),

%C - F_{b, c} is a permutation of the nonnegative integers with inverse F_{c, b},

%C - F_{c, d} o F_{b, c} = F_{b, d} and F_{b, b} is the identity,

%C - in particular the present sequence corresponds to F_{2, 3} and its inverse to F_{3, 2}.

%H Rémy Sigrist, <a href="/A365278/b365278.txt">Table of n, a(n) for n = 0..8192</a>

%H Rémy Sigrist, <a href="/A365278/a365278.gp.txt">PARI program</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(2*n) = 3*a(n).

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

%F A077267(a(n)) = A023416(n).

%e 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.

%t A007931[n_]:=Rest[IntegerDigits[n+1,2]]+1;

%t A365278[n_]:=FromDigits[Flatten[Map[If[First[#]==1,A007931[Length[#]],#]&,Split[IntegerDigits[n,2]]]],3];

%t Array[A365278,100,0] (* _Paolo Xausa_, Oct 17 2023 *)

%o (PARI) See Links section.

%Y Cf. A007931, A023416, A032924, A077267, A290308, A365279 (inverse).

%K nonn,base

%O 0,3

%A _Rémy Sigrist_, Aug 30 2023