A057846 Sort the digits of n into alphabetical order (the "Obsessive Filer's Sequence").
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 41, 51, 16, 17, 81, 91, 20, 12, 22, 32, 42, 52, 62, 72, 82, 92, 30, 13, 32, 33, 43, 53, 63, 73, 83, 93, 40, 41, 42, 43, 44, 54, 46, 47, 84, 49, 50, 51, 52, 53, 54, 55, 56, 57, 85, 59, 60, 16, 62, 63, 46, 56, 66, 76, 86, 96, 70, 17, 72, 73, 47, 57, 76, 77, 87
Offset: 0
Examples
a(14)=41 because the digits of 14, 1 (one) and 4 (four), are in alphabetical order when arranged as 4, then 1, so 41.
References
- M. J. Halm, Sequences (Re)discovered, Mpossibilities 81 (Aug. 2002), p. 1.
Links
- Ivan Neretin, Table of n, a(n) for n = 0..10000
- Michael Halm, Sequences (Re)discovered, retrieved on July 28, 2013
Programs
-
Mathematica
s = {9, 4, 8, 7, 2, 1, 6, 5, 0, 3}; Table[FromDigits[Sort[IntegerDigits[n], s[[#1 + 1]] < s[[#2 + 1]] &]], {n, 78}] (* Ivan Neretin, Jul 09 2015 *)
-
PARI
A057846(n,o=[9, 4, 8, 7, 2, 1, 6, 5, 0, 3])= {sum(i=1,#n=vecsort(digits(n),(a,b)->o[b+1]-o[a+1]),n[i]*10^i)/10} \\ - M. F. Hasler, Jul 28 2013
-
Python
def k(c): return "8549176320".index(c) def a(n): return int("".join(sorted(str(n), key=k))) print([a(n) for n in range(100)]) # Michael S. Branicky, Aug 17 2022
Extensions
Edited by N. J. A. Sloane, Aug 31 2006
Original terms 76, 86, 96 restored by Rick L. Shepherd, Jul 26 2013
Comments