A319656 Write n in 8-ary, sort digits into increasing order.
0, 1, 2, 3, 4, 5, 6, 7, 1, 9, 10, 11, 12, 13, 14, 15, 2, 10, 18, 19, 20, 21, 22, 23, 3, 11, 19, 27, 28, 29, 30, 31, 4, 12, 20, 28, 36, 37, 38, 39, 5, 13, 21, 29, 37, 45, 46, 47, 6, 14, 22, 30, 38, 46, 54, 55, 7, 15, 23, 31, 39, 47, 55, 63, 1, 9, 10, 11, 12, 13, 14
Offset: 0
Links
- Seiichi Manyama, Table of n, a(n) for n = 0..4095
Crossrefs
Programs
-
Maple
a:= n-> (l-> add(l[-i]*8^(i-1), i=1..nops(l)))(sort(convert(n, base, 8))): seq(a(n), n=0..70); # Alois P. Heinz, Aug 07 2024
-
Mathematica
Table[FromDigits[Sort[IntegerDigits[n, 8]], 8], {n, 0, 100}] (* Paolo Xausa, Aug 07 2024 *)
-
PARI
a(n) = fromdigits(vecsort(digits(n, 8)), 8); \\ Michel Marcus, Sep 25 2018
-
Ruby
def A(k, n) (0..n).map{|i| i.to_s(k).split('').sort.join.to_i(k)} end p A(8, 100)