

A164884


a(n) = image of n under the base2 Kaprekar map n > (n with digits sorted into descending order)  (n with digits sorted into ascending order).


22



0, 0, 1, 0, 3, 3, 3, 0, 7, 9, 9, 7, 9, 7, 7, 0, 15, 21, 21, 21, 21, 21, 21, 15, 21, 21, 21, 15, 21, 15, 15, 0, 31, 45, 45, 49, 45, 49, 49, 45, 45, 49, 49, 45, 49, 45, 45, 31, 45, 49, 49, 45, 49, 45, 45, 31, 49, 45, 45, 31, 45, 31, 31, 0, 63, 93, 93, 105, 93, 105, 105, 105, 93, 105, 105
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,5


LINKS

Indranil Ghosh, Table of n, a(n) for n = 0..16384 (terms 0..1024 from Joseph Myers)
Index entries for the Kaprekar map


EXAMPLE

For n = 17, 17_10 = 10001_2. So, a(17) = 11000_2  11_2 = 24  3 = 21.  Indranil Ghosh, Feb 01 2017


PROG

(Python)
def A164884(n):
....return int("".join(sorted(bin(n)[2:], reverse=True)), 2)int("".join(sorted(bin(n)[2:])), 2) # Indranil Ghosh, Feb 01 2017


CROSSREFS

Cf. A163205, A164885, A164886, A164887.
In other bases: A164993 (base 3), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10).
Sequence in context: A126660 A202698 A320785 * A019801 A086634 A066601
Adjacent sequences: A164881 A164882 A164883 * A164885 A164886 A164887


KEYWORD

base,nonn


AUTHOR

Joseph Myers, Aug 29 2009


EXTENSIONS

Crossreferences edited by Joseph Myers, Sep 04 2009


STATUS

approved



