Just a little Saturday Afternoon fun.
Take a three digit number and arrange it's digits in ascending number. Call the three digit number that you get N1.Arrange the numbers in descending order and call the three digit number you now get N2.Now subtract N1 from N2. Call this whole procedure iteration one.The resulting three digit number will be 495 (Kaprekar's Constant) after a certain number of iterations.It is 495 since applying the process to that number brings it back to itself.So 495 is the Kaprekar fixed point.(for three digit numbers)
One can start with single and double digit numbers by appending zeros to the front.Infact during the iterations if the result of subtraction comes to be a two digit number then zeros have to be appended outfront to keep the number of digits 3.Not doing that can lead to zero and not the constant (consider the result 99).The process obviously fails for multiples of Nelson.
One can ask if the number of iterations required would be periodic(or have some pattern) in the natural number argument to start the iterations.Rather than work out the algebra (which to me seemed to involve a lot of conditional routes if analytics of the process is possible) I wrote a matlab program (but blogspot does not let me upload it here!) to plot number of iterations required against a user fed limit,N.The maximum number of iterations required for any number is 6 and the least is 1(By definition). (Kaprekar's constant itself needs to be processed once to get back to itself.)
Here's the Graph:
May be connecting the dots would be more appealing (though mathematically absurd since the process requires natural number input and cannot be interpolated).But here it goes:
Is this periodic? Is there any symmetry?what is the period if there is one?
Do four digit numbers settle to such a value ?Yes they do!!! The K constant in this case happens to be 6174.which I discovered reading here. More on this later.
P.S: Just discovered that people at mathematica beat me blue long long back...they have something called the Generalized Kaprekar Routine .(Aagh!!!)
Saturday, April 10, 2010
Subscribe to:
Post Comments (Atom)
Too good!!! Seems like you are getting the hang of MATLAB...
ReplyDelete