Carry the one

I’ve been nibbling through Douglas R. Hofstadter’s Pulitzer Prize-winning book, Gödel, Escher, Bach. In Chapter XVII he mentions the mathematician Srinivasa Ramanujan (1887-1920) who had a talent for extremely fast mathematical analysis. This class of mind (including so-called idiot savants) he called lightning calculators. In this passage he discusses the unlikelihood that such minds have access to resources or processes outside of general recursive functions:

One could probably make a nice plot showing how the time taken by a lightning calculator varies with the size of the numbers involved, and the operations involved, and from it deduce some features of the algorithms employed.

This got me thinking about my own mathematical algorithms. By that term I mean the series of atomic steps taken to produce a result such as the sum 14 + 38 = 52 or the quotient 39 ÷ 3 = 13.

I vaguely remember being taught to add two-digit numbers in grade school. The process begins with the numbers stacked so that the ones and tens places are vertically aligned. A horizontal line is drawn to separate the stack from the result below. Starting with the right-most column, we sum each column and place the result below the stack. If the result is two digits, place the “ones” numeral below the current column and the “tens” numeral above the next colmn to the left. (“Carry the one.”) Here is the final product, showing the work done:

  1   ← carry the one
  14
+ 38
  52

That is the most basic algorithm in my mathematical toolbox. You probably have a similar algorithm that you use to add a column of numbers. Maybe you visualize the stack and proceed consciously through the steps or perhaps you have trained your mind to produce mathematical results at a subconscious level. Hofstadter’s point was that everyone’s result must be produced, at some level, by a series of simple steps he called a general recursive function (Church-Turing Thesis).

Reading about this, I realized that my own addition algorithm proceeds not from right to left but from left to right. Whereas the standard method begins with the least significant digits, my method begins with the most significant digits. (Lets leave the Freudian isomorphisms out of this discussion, interesting though they may be.) Here is the way I add numbers:

Stack the numbers as before. Sum the left-most column and write the result below. (Begin loop.) Sum the next column and if it exceeds one digit, increment the previous result and append the new result. (End loop.)

I wonder whether my algorithm can produce results with fewer operations on average. I guess that if the likelihood of column sums exceeding one digit is less than a certain threshold, my method will be faster (completing in fewer operations). Perhaps one method is easier for minds having a specific learning preference, i.e. visual or auditory or tactile.

Here’s homework for the curious: write a program that compares these algorithms in terms of number of operations to sum every possible set of two, three, and four numbers having two, three, and four digits. If my method is faster for some class of sums, such as those having an instantly recognizable feature like a low occurrence of digits greater than five, would the extra steps of recognizing such a class and selecting the most appropriate algorithm improve the overall speed of doing sums?

My hope is that somebody can produce objective proof that my summing algorithm is not always slower than the right-to-left method taught to me in school. If not, I might be afflicted with mathematics disorder—an actual diagnosis in the DSM-IV. Pfizer?

The Need for Shelves

The burden of things is their need for space. Each thing must occupy its own space and no two things may occupy the same space. Waves are exempt but none of my possessions are waves. This is why I need shelves.

The burden of company is the same. Bodies are like things except they complain when stacked in the corner or strewn about the floors. At least, living ones do, and I don’t invite the dead. This is why I need sofas.

I learned how to tie my shoes when I was 22

Don’t let the title fool you. Like any kid, I was taught to tie my shoes at a young age. I didn’t know a bowline from a Double Windsor and I sure didn’t know a square knot from a granny knot. I simply learned to do it the way I was taught. I wasn’t bothered by the fact that my knots never lasted more than a few hours. I had been taught to tie my shoes and my teacher had approved of my knots. Tying them this way several times a day had turned the knotting action into a habitual chore but its effortlessness kept it below my annoyance threshold for several years.

It was at the ripe and rebellious age of twenty-two that I finally got fed up with the constant need to re-tie my shoelaces. I was this close to buying Velcro shoes but I decided to make the effort to change my habit. It suddenly required great attention to tie my shoes but I found that I only had to do it once a day. After a few weeks I had altered the habit and it became easier to tie them in the new, more effective knot. After a month it was difficult to remember the old way.

Soon I discovered that I could remove and put on my shoes without untying them. I knew that some people did this and I had chalked it up to laziness. In fact, my inferior knots were seldom tied when it came time to step out of my shoes. My poor shoe-tying skills were the reason I never picked up the habit of stepping into tied shoes. With my new knotting habits came new shoeing habits and I began to step in and out of tied shoes. I had a pair of orange Saucony Jazz sneakers that stayed tied for years. I hadn’t tied them especially tightly. My new knots simply lasted longer than shoes!

If your shoelaces won’t stay tied, don’t commit to a double-knot until you have discovered exactly what kind of knot you’re tying. If it’s a granny knot with loops like mine was, try switching to a square knot. You just have to reverse the direction of the second twist. (You know, make the left bunny ear run around the right one for a change, or whatever does it for you. I don’t know from bunnies. Ask Ian.)

How can you tell a nightmare?

I, as my present self with my present possessions and obligations, woke up in a hotel in my college town at the end of a spring semester. All my gear was gone. I was without clothes, wallet, keys, phone, briefcase, computer.

My house—it had ceased to be a hotel room—was full of excited people taking their things and leaving for the summer. Boxes filled every room and corridor so that it was hard to move around. A woman repeatedly caught my eye while flitting in and out of rooms and collecting objects. It was strange to find every bed in my house occupied. These people had made themselves at home in my home and I didn’t recall inviting them but I didn’t mind because they were all getting up and leaving.

Many wonderful items littered the open spaces of my house. There were boxes of music and movies, each one bearing the mark of a well-loved friend and their signature odor. Piles of gadgets flowed out from fireplaces. Happy dogs caromed off everything.

Everywhere I looked, there was a friendly stranger saying goodbye. I would have liked to own any of the things they were taking away but I did not want any of their things and I could not see anyone taking anything that I needed, or that belonged to me. My possessions were still missing and I continued to hunt for them.

After searching every other place, I returned to the room where I had woken up. There was no lock on the door. Somebody was there. It was the woman! She was putting on a shirt. It was my shirt! She was glancing at an empty spot on the table. It was the spot where my things had been! I snatched her by the wrist and demanded, “Where is it?”

The woman yelped and protested. She looked guilty but she was becoming more beautiful before my eyes. I called out, “Help! Theif! Police!” Moving into the corridor with the woman in tow, I found a friendly policeman. The woman denied taking my briefcase with my wallet and phone and computer inside. I hadn’t named the stolen articles! She had obviously taken my things but the policeman urged me to embrace the loss.

“What will happen if you lose those things?”

“Nothing much. I’ll report the credit cards stolen and suspend the phone service. I’ll get new cards, a new phone, a new computer. It’s just a pain.”

“It is a pain. How would you like it if you never replaced those things?”

“That is my dream.”

“Why don’t you let the woman go?”

I looked at her. She had become the most beautiful person in the world and her eyes swore that she was mine.