%I #27 Mar 12 2020 00:25:43
%S 1,3,4,2,7,9,10,12,13,5,16,6,19,21,22,8,25,27,28,30,31,11,34,36,37,39,
%T 40,14,43,15,46,48,49,17,52,18,55,57,58,20,61,63,64,66,67,23,70,24,73,
%U 75,76,26,79,81,82,84,85,29,88,90,91,93,94
%N a(n) is the position of n in A026177.
%C Inverse of A026177.
%C From _Kevin Ryde_, Feb 06 2020: (Start)
%C The formulas below are seen by considering values taken in the inverse A026177. Dekking's case II there is here a(2n) = n when lowest non-0 ternary digit LNZ(n) = A060236(n) = 2, which is LNZ(2n)=1. Otherwise case III is here a(2n+1) = 3n+1 and case IV is here a(2n) = 3n. These can be combined by a floor (the inverse of the ceiling in A026177).
%C For positive c with LNZ(c)=1, so c = (3j+1)*3^k = A026225, this sequence has a self-similarity in that taking the values which are multiples of c, and dividing them by c, gives the full sequence again. Using the inverse A026177, a(n)=c*m here is located at n = A026177(c*m) = c*A026177(m) - (floor(c/3) if m==1 (mod 3)) since c*m goes to the same bigger or smaller case in A026177 as m does. Then since floor(c/2) < c, values c*m are in the same order as all values m.
%C (End)
%H Michael De Vlieger, <a href="/A026178/b026178.txt">Table of n, a(n) for n = 1..10000</a>
%H F. M. Dekking, <a href="https://arxiv.org/abs/2001.08915">Permutations of N generated by left-right filling algorithms</a>, arXiv:2001.08915 [math.CO], 2020.
%F From _Kevin Ryde_, Feb 06 2020: (Start)
%F a(n) = n/2 if n even and A060236(n)=1, otherwise a(n) = floor(3n/2), where A060236(n) is the lowest non-0 ternary digit of n.
%F a(3n) = 3*a(n) + (1 if n odd).
%F (End)
%t Values[Take[#, LengthWhile[Differences@ Keys@ #, # == 1 &]]][[All, 1]] &@ KeySort@ PositionIndex@ Array[If[Mod[#/3^IntegerExponent[#, 3], 3] == 1, Ceiling[2 #/3], 2 #] &, 94] (* or *)
%t Block[{nn = 63, s}, s = Array[If[Mod[#/3^IntegerExponent[#, 3], 3] == 1, Ceiling[2 #/3], 2 #] &, Ceiling[3 nn/2]]; Array[FirstPosition[s, #][[1]] &, nn]] (* _Michael De Vlieger_, Feb 08 2020 *)
%o (PARI) a(n) = if(n%2 || (n/3^valuation(n,3))%3==2, floor(3*n/2), n/2);
%Y Cf. A026177 (inverse).
%K nonn
%O 1,2
%A _Clark Kimberling_
%E Edited by _N. J. A. Sloane_, Feb 05 2020
|