login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A163205 The non-repetitive Kaprekar binary numbers in decimal. 40

%I #20 Dec 24 2018 06:13:59

%S 0,9,21,45,49,93,105,189,217,225,381,441,465,765,889,945,961,1533,

%T 1785,1905,1953,3069,3577,3825,3937,3969,6141,7161,7665,7905,8001,

%U 12285,14329,15345,15841,16065,16129,24573,28665,30705,31713,32193,32385

%N The non-repetitive Kaprekar binary numbers in decimal.

%C Same as A160761, but with no repetitions. The numbers also exist in A143088, except that every first and last number is omitted from A143088's pyramid.

%C From _Joseph Myers_, Aug 29 2009: (Start)

%C Note that all base-2 cycles are fixed points.

%C Initial terms in base 2: 0, 1001, 10101, 101101, 110001, 1011101, 1101001, 10111101, 11011001, 11100001. (End)

%D M. Charosh, Some Applications of Casting Out 999...'s, Journal of Recreational Mathematics 14, 1981-82, pp. 111-118.

%D D. R. Kaprekar, On Kaprekar numbers, J. Rec. Math., 13 (1980-1981), pp. 81-82.

%H Joseph Myers, <a href="/A163205/b163205.txt">Table of n, a(n) for n = 1..9802</a> [From _Joseph Myers_, Aug 29 2009]

%H Juergen Koeller, <a href="http://www.mathematische-basteleien.de/kaprekar.htm">The Kaprekar Number </a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Kaprekar_number">Kaprekar Number</a>

%H <a href="/index/K#Kaprekar_map">Index entries for the Kaprekar map</a>

%F 1. Sort all integers from the number in descending order.

%F 2. Sort all integers from the number in ascending order.

%F 3. Subtract ascending from descending order to obtain a new number.

%F 4. Repeat the steps 1-3 with a new number until a repetitive sequence is obtained or until a zero is obtained.

%F 5. Call the repetitive sequence's number a Kaprekar number, ignore zeros and repetitions from the set of the final results.

%e The number 9 is 1001 in binary. The maximum number using the same number of 0's and 1's is found and the minimum number having the same number of 0's and 1's is found to obtain the equation such as 1100 - 0011 = 1001. Repeating the same procedure gives us the same number and pattern of 0's and 1's. Therefore 9 is one of the Kaprekar numbers. If 9 did not occur before, it is counted as a number that belongs to a sequence and added to a database to skip repetitions. Numbers that end the procedure in 0 are excluded since they are not Kaprekar numbers. A number 9 can also be obtained with, let's say, 1100. Since number 9 already occured for 1001, the number 9 occurring for 1100 is ignored to avoid repetition.

%t nmax = 10^5; f[n_] := Module[{id, sid, min, max}, id = IntegerDigits[n, 2]; min = FromDigits[sid = Sort[id], 2]; max = FromDigits[Reverse[sid], 2]; max - min]; Reap[Do[If[(fpn = FixedPoint[f, n]) > 0, Sow[fpn]], {n, 0, nmax}]][[2, 1]] // Union // Prepend[#, 0]& (* _Jean-François Alcover_, Apr 23 2017 *)

%o (Java) import java.util.*; class pattern { public static void main(String args[]) { int mem1 = 0; int mem2 =1; ArrayList<Integer> memory = new ArrayList<Integer>(); for (int i = 1; i<Integer.MAX_VALUE; i++) { do { mem1 = mem2; String binaryi = Integer.toBinaryString(i); String binarysort = ""; String binaryminimum = ""; for (int n = 0; n< binaryi.length(); n++) { String g = binaryi.substring(n, n+1);

%o if (g.equals("0")) { binarysort = binarysort+"0"; } else { binarysort = "1"+binarysort; binaryminimum = binaryminimum + "1"; } } int binrev1 = Integer.parseInt(binarysort , 2); int binrev2 = Integer.parseInt(binaryminimum , 2); int diff = binrev1 - binrev2; mem2 = diff; } while (mem2!=0 && mem2!=mem1); String memtobin = Integer.toBinaryString(mem1); int ones = 0; for (int t = 0; t<memtobin.length(); t++) { String o = memtobin.substring(t, t+1); if (o.equals("1")) ones++; } if (memtobin.length()!=ones) { if(!memory.contains (mem1)) {System.out.print(mem1+" "); memory.add(mem1);} } } }}

%Y Cf. A160761, A143088, A164884, A164885, A164886, A164887.

%Y In other bases: A164997 (base 3), A165016 (base 4), A165036 (base 5), A165055 (base 6), A165075 (base 7), A165094 (base 8), A165114 (base 9), A099009 (base 10).

%K nonn,base

%O 1,2

%A _Damir Olejar_, Jul 23 2009

%E Initial zero added for consistency with other bases by _Joseph Myers_, Aug 29 2009

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)