login
Write n in 9-ary, sort digits into decreasing order.
9

%I #18 Aug 07 2024 10:35:25

%S 0,1,2,3,4,5,6,7,8,9,10,19,28,37,46,55,64,73,18,19,20,29,38,47,56,65,

%T 74,27,28,29,30,39,48,57,66,75,36,37,38,39,40,49,58,67,76,45,46,47,48,

%U 49,50,59,68,77,54,55,56,57,58,59,60,69,78,63,64,65,66,67,68,69

%N Write n in 9-ary, sort digits into decreasing order.

%H Seiichi Manyama, <a href="/A319726/b319726.txt">Table of n, a(n) for n = 0..6560</a>

%F n <= a(n) < 9n. - _Charles R Greathouse IV_, Aug 07 2024

%t Table[FromDigits[Reverse[Sort[IntegerDigits[n,9]]],9],{n,0,70}] (* _Harvey P. Dale_, Oct 26 2022 *)

%o (Ruby)

%o def A(k, n)

%o (0..n).map{|i| i.to_s(k).split('').sort.reverse.join.to_i(k)}

%o end

%o p A(9, 100)

%o (PARI) a(n) = fromdigits(vecsort(digits(n, 9), , 4), 9); \\ _Michel Marcus_, Sep 26 2018

%Y b-ary: A073138 (b=2), A319651 (b=3), A319720 (b=4), A319722 (b=5), A319723 (b=6), A319724 (b=7), A319725 (b=8), this sequence (b=9), A004186 (b=10).

%Y Cf. A165110, A319657.

%K nonn,base,look,easy

%O 0,3

%A _Seiichi Manyama_, Sep 26 2018