This site is supported by donations to The OEIS Foundation.

 Please make a donation to keep the OEIS running. We are now in our 55th year. In the past year we added 12000 new sequences and reached 8000 citations (which often say "discovered thanks to the OEIS"). We need to raise money to hire someone to manage submissions, which would reduce the load on our editors and speed up editing. Other ways to donate

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A165012 a(n) = image of n under the base-4 Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order). 31
 0, 0, 0, 0, 3, 0, 3, 6, 6, 3, 0, 3, 9, 6, 3, 0, 15, 15, 30, 45, 15, 0, 15, 30, 30, 15, 15, 30, 45, 30, 30, 30, 30, 30, 30, 45, 30, 15, 15, 30, 30, 15, 0, 15, 45, 30, 15, 15, 45, 45, 45, 45, 45, 30, 30, 30, 45, 30, 15, 15, 45, 30, 15, 0, 63, 75, 138, 201, 75, 63, 126, 189, 138, 126 (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) EXAMPLE For n = 11, 11_10 = 23_4. So, a(11) = 32_4 - 23_4 = 14 - 11 = 3. - Indranil Ghosh, Feb 02 2017 MATHEMATICA b4km[n_]:=Module[{idn4=Sort[IntegerDigits[n, 4]]}, FromDigits[ Reverse[ idn4], 4]-FromDigits[idn4, 4]]; Array[b4km, 80, 0] PROG (PARI) cons(m) = {local(b, r); r=0; b=1; for(i=1, matsize(m)[2], r=r+b*m[i]; b=b*4); r} A165012(n) = {local(m, r); r=[]; m=n; while(m>0, r=concat(m%4, r); m=floor(m/4)); cons(vecsort(r, , 0))-cons(vecsort(r, , 4))} \\ Michael B. Porter, Nov 05 2009 CROSSREFS Cf. A165013. In other bases: A164884 (base 2), A164993 (base 3), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9), A151949 (base 10). Sequence in context: A226568 A038517 A055949 * A198126 A074694 A127803 Adjacent sequences:  A165009 A165010 A165011 * A165013 A165014 A165015 KEYWORD base,nonn AUTHOR Joseph Myers, Sep 04 2009 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified December 13 06:26 EST 2019. Contains 329968 sequences. (Running on oeis4.)