## Saturday, May 22, 2010

### KAPREKAR'S SOLITAIRE

We have all heard of Srinivasa Ramanujam, the great Indian mathematician, but if I mention D R Kaprekar, you’ll ask me, Kaprekar who?

Dattaraya Ramchandra Kaprekar was a schoolteacher in Nashik (Maharashtra). This 1905-born received his secondary school education in Thane and studied at Fergusson College in Pune. In 1927, he won the Wrangler R. P. Paranjpe Mathematical Prize for an original piece of work in mathematics. He had no formal postgraduate training and working alone, discovered several interesting properties of numbers.

Initially, his ideas were not taken seriously by Indian mathematicians. International fame arrived late in 1975 when Martin Gardner wrote about Kaprekar in his column Mathematical Games for The Scientific American. Today his name is well-known and many other mathematicians have pursued the study of the properties he discovered.

Though he is credited with the discovery of Devlali Numbers, Harshad Numbers and Demlo Numbers, the most famous of his discoveries is the Kaprekar Constant.

Most numbers can be generated by adding another number and its digits. For instance, take 23. It is 16 + 1 + 6. Take 70. It is 62 + 6 + 2. Now try the same thing with 20. Now matter what you do, it is impossible to generate 20 in this manner. Thus 20 is a Devlali Number. The first 20 Devlali Numbers are 1, 3, 5, 7, 9, 20, 31, 42, 53, 64, 75, 86, 97, 108, 110, 121, 132, 143, 154, 165, 176, 187, 198, 209 and 211.

A Harshad number is one divisible by the sum of its digits. Take 23. As it is not divisible by 2 + 3 = 5, it is a non-Harshad Number. However, 70 is, as it can be divided by 7 + 0 = 7. The numbers 1 to 9 are all obviously Harshad Numbers. The next 25 Harshad numbers are 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100 and 102.

I found the Demlo Numbers too complicated for me but Kaprekar Constant, the jewel on the Kaprekar crown, is fascinating. It is a really mysterious number, though at first glance, it might not seem so obvious.

Take any four-digit number with at least one digit different from the rest.(That is, not 1111, 2222, ...). Write down the largest and the smallest numbers that can be formed from its digits. Subtract the smaller number from the larger to get a new number. Repeat the operation for the result obtained. If you carry one the process, you will find that it ends in a number that repeats itself. Let us call this repeating number the kernel of this operation for that number.

For instance, let's take 2010, the current year. The largest number we can make with these digits is 2100, and the smallest is 0012 or 12. The process is: 2100 – 12 = 2088 >> 8820 – 288 = 8532 >> 8532 – 2358 = 6174 >> 7641 – 1467 = 6174 >> 7641 – 1467 = 6174 >> … We find that the kernel of 2010 is 6174 and have reached the kernel in three steps.

Okay, you reach a kernel, so what?

Now take 2005. The operation yields 5200 – 0025 = 5175 >> 7551 – 1557 = 5994 >> 9954 – 4599 = 5355 >> 5553 – 3555 = 1998 >> 9981 – 1899 = 8082 >> 8820 – 0288 = 8532 >> 8532 – 2358 = 6174 >> 7641 – 1467 = 6174 >> 7641 – 1467 = 6174 >> …

This time it has taken a few more steps to reach the kernel from 2005, but are you surprised that the kernel is the same, namely 6174? Sheer coincidence, you and I would have thought.

Kaprekar thought differently. He discovered that this simple operation led to the surprising result that the kernel cannot but be 6174! Every four digit number where the digits aren't all equal reaches 6174 under Kaprekar's process. It's marvellous, isn't it? Kaprekar's operation is so simple but uncovers such an interesting result.

Is this as special as 6174 gets? Well, not only is 6174 the only kernel for the operation, it also has one more surprise up its sleeve.

Let's try again, starting with a different number, say 1789. Here we go: 9871 – 1789 = 8082 >> 8820 – 0288 = 8532 >> 8532 – 2358 = 6174.

When we started with 2010 and 1789, the process took us to 6174 in three steps, but 2005 took seven steps. In fact, you reach 6174 for all four-digit numbers that don't have all the digits the same and in at most seven steps.

For three-digit numbers, the same phenomenon occurs. Application of Kaprekar's operation to the three digit number 753 gives the following: 753 – 357 = 396 >> 963 – 369 = 594 >> 954 – 459 = 495 >> 954 – 459 = 495 >> 954 – 459 = 495 >> … The number 495 is the unique kernel for the operation on three digit numbers, and all three digit numbers reach 495 using the operation.

How about other numbers? Let try it out for a two digit number, say 28. We have 82 – 28 = 54 >> 54 – 45 = 9 >> 90 – 09 = 81 >> 81 – 18 = 63 >> 63 – 36 = 27 >> 72 – 27 = 45 >> 54 – 45 = 9 >> 90 – 09 = 81 >> 81 – 18 = 63 >> 63 – 36 = 27 >> 72 – 27 = 45 >> 54 – 45 = 9 >> … It doesn't take long to check that all two digit numbers will reach the loop 9 → 81 → 63 → 27 → 45 → 9. Not quite as impressive as three and four digit numbers, which have unique kernels.

There is no kernel for Kaprekar's operation on five digit numbers. But all five digit numbers do reach one of the following three loops:

71973 → 83952 → 74943 → 62964 → 71973
75933 → 63954 → 61974 → 82962 → 75933
59994 → 53955 → 59994

It will certainly take a lot of time to check what happens for six or more digits, and this work becomes extremely dull! I’d rather play Solitaire than meddle with numbers like Kaprekar did!

## Thursday, May 20, 2010

### FELLOW-FEELING

I was looking for a Khalil Gibran quote. I knew it was there in one of the paperbacks I have, but did not recall which one. I went to my study looking for it.

The books were in a total disarray. Giving up the search for the quote for the time being, I decided to rearrange them on the shelves in some order so that one would not have to launch a search the next time.

As I dusted the books one by one and put them in their assigned places, a book caught my attention. It was a Malayalam paperback: ‘Vasco da Gaamayum, Charitrattile Kaanappuranngalum’ (Vasco da Gama and the Unseen Pages of History) by Sathyan Edakkad. I am not much of a history buff and did not recall having purchased it. My wife Bhawani is interested in history, but it was very unlikely that she would have purchased a book written in Malayalam.

It appeared to be a new book, not read by either of us. How did it reach here? I wondered. Bhawani refreshed my memory, Santanu had dropped it in your bag at the Fort in Kannur.

***

My Bengali friend Santanu and his wife Arundhati were on a ten-day visit to Kerala. Santanu was a colleague and we have known each other for over three decades. Santanu had taken an early severance and turned to writing and translation and had published a few books, which, I guess, were a modest success.

Though they had lived for a while in Kerala as Santanu was employed here, they had not had the chance to ‘experience’ Kerala. We decided to drive down from Trivandrum (in the southern tip) where we lived, to my hometown Kannur (500+ kms to the north) with a few pitstops. They would stay with us in Trivandrum for a couple of days, travel the longish stretch with us over three days and stay with us and my mother in Kannur for a few days.

While in Kannur, we went round seeing places of interest in and around Kannur like the Pazhassi Project, the Arackal Museum, the Muzhappilangad beach (Arundhati quips that the name is as hard as the beach. The beach, in case you did not know, is so hard that you can drive cars on the sand at 60 kmph!) and the like.

One of our destinations was the recently beautified premises the St Angelo’s Fort on Kannur Beach. A seashore fort, it's a photographer's delight, etched against the blue sky. The spirit of the past still echoes within the walls of this fort and continues to enthrall its visitors.

As soon as we crossed the moat (apparently built to protect the fort from aggressors) and entered the premises made up of massive laterite stones built on a rocky promontory, a young policeman accosted us. His epaulet had a brass plaque which read TOURIST POLICE.

The sergeant was very friendly. He asked us if it was the first time we were visiting the fort. He told us the chequered history of the fort in brief. As he walked us through the endless corridors of the fort, up the turret and through the manicured lawns, the spool unreeled: how it was built in 1505 by Dom Francisco de Almeida, the first Portuguese Viceroy of India and how it changed hands many times over..

Almeida had refused to accept the appointment of Afonso de Albuquerque in 1509 as the new Portuguese governor. Desperate to continue as the boss of what he considered ‘the gains of his hard work’; he went to war with Albuquerque and imprisoned him in this fortress. After three months of confinement, Albuquerque went on to become the governor when the mutiny was suppressed with the arrival of a larger fleet from Portugal in October 1509.

In 1663, the fort was captured by the Dutch from the Portuguese. They sold it to Ali Raja (of the Arackal Dynasty) of Kannur. After the ascendancy of the British in Malabar, in 1790, the British seized control of the fort, renovated and strengthened it and transformed into their most important military station in Malabar.

We were surprised and impressed by the cop’s knowledge. We could not resist the temptation to ask him how he learnt all this. He said he was shocked at the ignorance surrounding the earliest European fort in India. When he was posted there, he said, the impression among the locals was that it was Tipu Sultan who had constructed the fort! As a tourist cop, Sathyan had to face a barrage of questions about the fort from visitors to which he had no answers. That made him brush up his history. He spent a lot of time reading up history and became a walking encyclopedia on the fort and its legends.

As we complimented him on his interest and knowledge and thanked him and wished him well, he smiled shyly and said, ‘I have written a book exploding the myth of Vasco da Gama’s landing at Kappad in 1498.’ I leafed through the copy he showed me. The book, written in Malayalam, challenged a basic historical assumption. ‘Two of Vasco da Gama’s sailors landed at Kappad,’ Sathyan says in the book, ‘but Gama stepped ashore 12 km north, at a place called Panthalayini Kollam.’

Santanu asked him, ‘How much does this book cost?’ Sathyan named the price. Santanu, who cannot read Malayalam, bought a copy. As I wondered why, he said, ‘This is the least that a struggling author can do to encourage another.’