There was a time when I was very good in math. Not to brag, but I was particularly good in geometry, especially at visualizing geometric forms in my mind and calculating angles of sides and the area of shapes. I probably should have studied more math instead of history, since being a history teacher was an occupation only slightly more honorable than being a towel boy in a Turkish bath house and a little lower than being a piano player in a whorehouse.
Unfortunately, somewhere in the last half century, I have forgotten a lot of what I knew about math. Now that I’m retired from teaching, I have gone back to school to sort of fill in some of the blank spots in my education. Since retired faculty do not have to pay tuition to attend Enema U, I have discovered that Bachelor’s Degrees are kind of like potato chips—it’s hard to stop after the first one…Or the third…Or the fourth. If I can hold out another couple of decades, I intend to collect the entire set.
Currently, I’m a senior (pun intended) in Economics—a field that uses a lot of math. Accordingly, I decided to retake Calculus to try and brush up on what I had forgotten. In the half century since I took the course, we have stopped using slide rules and have evidently renamed everything. No matter what we study, I seem to suddenly remember it about three days after the test.Being the oldest person in the room, by a factor of at least e^.69 (including the instructor) does have a few benefits. The rest of the people in the room were raised with calculators and seem incapable of doing any math in their heads. Did they stop teaching the multiplication tables in school?
So, for the last couple of weeks, I have been refreshing myself on various math terms, trying to jog an aging memory. Somewhere along the line, I came across the Kaprekar’s Constant, and I thought I would share it with you.
Kaprekar’s Constant is a strange little routine that inevitably produces the number 6174. Let me explain how it works. Pick any four digit number that uses two or more different numbers. 5483, 9888, or 1234 or all valid numbers while 1111 or 7777 are not. Then arrange the four digits in descending order, subtract from that number the four digits in ascending order and note the remainder. If necessary, add zero’s to the beginning of the number to produce four new digits.
If you do this a maximum of 7 times, the product is always 6174. Let me give you an example starting with 6810.
8610 The numbers in ascending order.
0168 The numbers in descending order.
8442 The difference
8442 The numbers in ascending order.
2448 The numbers in descending order.
5994 The difference
9954 The numbers in ascending order
4599 The numbers in descending order.
5355 The difference
5553 The numbers in ascending order.
3555 The numbers in descending order.
1998 The difference
9981 The numbers in ascending order.
1899 The numbers in descending order.
8082 The difference
8820 The numbers in ascending order.
0288 The numbers in descending order.
8532 The difference
8532 The numbers in ascending order.
2358 The numbers in descending order.
6174 The difference and Kaprekar’s Constant
It always ends up with a difference of 6174, and if you keep using the sequence, the difference stays the same. (7641 − 1467 = 6174.) The name comes from the Indian mathematician D. R. Kaprekar who discovered the sequence.
Naturally, I had to test this for myself, but didn’t want to sit around all day with a pen and paper, so I wrote a program in Basic to test the sequence. Yes, I know, Basic is a poor programming language and damn near obsolete, but I first learned to program in Fortran and since Basic is descended from Fortran, I find it the easiest to use while writing simple programs on my Apple iPhone. (Sue me, I’ve already established that I’m both old and nearly obsolete.)
Thankfully, a company called Misoft has an excellent Basic Interpreter App for the iPhone that allows you to write, execute, and store programs. I frequently amuse myself by writing useless little programs to pass the time. Just in case you are interested, I’ll give you the little program I wrote to play with Kaprekar’s Constant.
10 PRINT "Enter a 4-digit number:"
20 INPUT N
30 IF N < 1000 OR N > 9999 THEN PRINT "Invalid input. Please enter a 4-digit number.": GOTO 10
40 PRINT "Starting number: "; N
50 REM Sort digits in descending order
60 A = INT(N / 1000)
70 B = INT((N - A * 1000) / 100)
80 C = INT((N - A * 1000 - B * 100) / 10)
90 D = N - A * 1000 - B * 100 - C * 10
100 N = A * 1000 + B * 100 + C * 10 + D
110 PRINT "Descending order: "; N
120 REM Sort digits in ascending order
130 A = INT(N / 1000)
140 B = INT((N - A * 1000) / 100)
150 C = INT((N - A * 1000 - B * 100) / 10)
160 D = N - A * 1000 - B * 100 - C * 10
170 N = D * 1000 + C * 100 + B * 10 + A
180 PRINT "Ascending order: "; N
190 REM Calculate the difference
200 DIFF = N - INT(N / 1000) * 1000
210 PRINT "Difference: "; DIFF
220 REM Repeat until Kaprekar's number (6174) is reached
230 IF DIFF = 6174 THEN PRINT "Reached Kaprekar's number!": END
240 N = DIFF
250 GOTO 50
For what it’s worth, Kapreskar also came up with a constant for three digit numbers, but I’ll let you discover it for yourself.
You’re a very talented person Mr. Milliorn!
ReplyDeleteCompared to History, my BA in English-Communications is the equivalent in status to the Turkish towel boy's assistant towel washer. I do, however, have a fairly good idea where to put commas and I pretty much understand semicolons and exclamation points. I understood from my college advisor and head of the English department who advised me not to take engineering because there wouldn't be any jobs left in engineering by the time I graduated, that an understanding of grammar and punctuation would be an essential survival skill during the zombie apocalypse that would probably happen in the year 2000.
ReplyDeleteI was also good at math, especially geometry. I loved doing proofs.
ReplyDeleteThey taught me to use logic which got me in trouble as a graduate in English-Communications. I became adept at spotting flaws in logic. Then I took a couple of years' graduate work in psychology which made it nearly impossible to miss the psychological motivation behind a person's reliance on flawed logic. It has made me especially popular with my leftist friends who, when I take apart their flawed arguments, generally respond with something like, "You? Oh yeah!" I can't say I don't enjoy these interchanges. I type much faster than I did in high school typing class and generally wear out my opponents since I type faster than they can cut and paste from their leftist talking points memos. Most of the time they just give up.