Kaprekar’s Constant.

Just recently I came across ‘Kaprekar’s Constant‘ and maybe Mr Kaprekar had too much spare time… but still, it is quite interesting. The idea is to take a 4 digit number where the digits are not all the same then make the largest and smallest numbers possible with these digits, subtract the smaller from the larger then rinse and repeat with the result of the subtraction. e.g start with 4123     and in fact all 4 digits ‘converge’ to 6174! Now this is too good an opportunity for some Haskell… First let’s take an integer and extract its digits Read More


ˆ Back To Top