login
Numbers 1 through 10000 sorted lexicographically in ternary representation.
8

%I #15 Jun 18 2017 13:45:30

%S 1,3,9,27,81,243,729,2187,6561,6562,6563,2188,6564,6565,6566,2189,

%T 6567,6568,6569,730,2190,6570,6571,6572,2191,6573,6574,6575,2192,6576,

%U 6577,6578,731,2193,6579,6580,6581,2194,6582,6583,6584,2195,6585,6586,6587,244

%N Numbers 1 through 10000 sorted lexicographically in ternary representation.

%C A190129 = inverse permutation: a(A190129(n)) = A190129(a(n)) = n;

%C a(n) <> n for n > 1.

%H Reinhard Zumkeller, <a href="/A190128/b190128.txt">Table of n, a(n) for n = 1..10000</a> (full sequence)

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/LexicographicOrder.html">Lexicographic Order</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Ternary.html">Ternary</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lexicographical_order">Lexicographical order</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a>

%e a(12) = 2188 -> 10000001 [tern];

%e a(13) = 6564 -> 100000010 [tern];

%e a(14) = 6565 -> 100000011 [tern];

%e a(15) = 6566 -> 100000012 [tern];

%e a(16) = 2189 -> 10000002 [tern];

%e a(17) = 6567 -> 100000020 [tern];

%e a(18) = 6568 -> 100000021 [tern];

%e a(19) = 6569 -> 100000022 [tern];

%e a(20) = 730 -> 1000001 [tern];

%e a(21) = 2190 -> 10000010 [tern];

%e largest term a(5164) = 10000 -> 111201101 [tern];

%e last term a(10000) = 6560 -> 22222222 [tern], largest term lexicographically.

%o (Haskell)

%o import Data.Ord (comparing)

%o import Data.List (sortBy)

%o a190128 n = a190128_list !! (n-1)

%o a190128_list = sortBy (comparing (show . a007089)) [1..10000]

%Y Cf. A007089; A190126 (base 2), A190130 (base 8), A190016 (base 10), A190132 (base 12), A190134 (base 16).

%K nonn,base,fini,full

%O 1,2

%A _Reinhard Zumkeller_, May 06 2011