A026178 a(n) is the position of n in A026177.
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, 40, 14, 43, 15, 46, 48, 49, 17, 52, 18, 55, 57, 58, 20, 61, 63, 64, 66, 67, 23, 70, 24, 73, 75, 76, 26, 79, 81, 82, 84, 85, 29, 88, 90, 91, 93, 94
Offset: 1
Keywords
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
- F. M. Dekking, Permutations of N generated by left-right filling algorithms, arXiv:2001.08915 [math.CO], 2020.
Crossrefs
Cf. A026177 (inverse).
Programs
-
Mathematica
Values[Take[#, LengthWhile[Differences@ Keys@ #, # == 1 &]]][[All, 1]] &@ KeySort@ PositionIndex@ Array[If[Mod[#/3^IntegerExponent[#, 3], 3] == 1, Ceiling[2 #/3], 2 #] &, 94] (* or *) 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 *)
-
PARI
a(n) = if(n%2 || (n/3^valuation(n,3))%3==2, floor(3*n/2), n/2);
Formula
From Kevin Ryde, Feb 06 2020: (Start)
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.
a(3n) = 3*a(n) + (1 if n odd).
(End)
Extensions
Edited by N. J. A. Sloane, Feb 05 2020
Comments