Vikrant

0 - I have created new universe out of nothing, come have a look at it!

Kaprekar operation

Mathematician D. R. Kaprekar played with four digit numbers and found a magic number 6174. He did something now known as kaprekar operation. Kaprekar operation can be defined as follows. Choose any four digit number. Permute its digits to form maximum and minimum number using those digits. take difference of these two numbers. One gets new number. On this number again keep performing above operation. Surprisingly the operation tends to converge the result to a unique number, 6174! I was delighted to see this nice property of 6174. I wrote haskell programme for it to verify as well as experiment more. Once programme is ready it was easy for me to perform kaprekar operation for various numbers with different number of digits. 3 digit numbers converged to 495. Then I was expecting that even 6, 7 or 8 digit number should converge to some number! But it didn't. Still there was interesting property seen! Although these number do not converge to a single number, the process gets trapped between more than one number. It converges to some kind of sequence. You can see similar patterns for numbers with same number of digits. I generated following patterns for numbers with digits 5, 6 and 7.

kaprekar operation

haskell function for performing kaprekar operation...

-- performs kaprekar operation on given number for given number of digits
kaprekar::Int->Int->Int
kaprekar n numDigits =
    let
        digits = paddZeros (split n) numDigits
        max = join (quicksort digits)
        min = join (reverse (quicksort digits))
    in (max - min)

Comments

I have visited your site 007-times

Your site found in Google: <a href="position921</a>>