Maybe you’re doing more than you need to

Suppose a = 2485144657 and b = 7751389993.

  1. What is the last digit of a*b?
  2. What is the median digit of a*b?

In both questions it is conceptually necessary to compute a*b, but not logically necessary. Both are a question about a*b, so computing the product is conceptually necessary. But there is no logical necessity to actually compute a*b in order to answer a question about it.

In the first question, there’s an obvious short cut: multiply the last two digits and see that the last digit of the product must be 1.

In the second question, it is conceivable that there is some way to find the median digit that is less work than computing a*b first, though I don’t see how. Conceptually, you need to find the digits that make up a*b, sort them, and select the one in the middle. But it is conceivable, for example, that there is some way to find the digits of a*b that is less work than finding them in the right order, i.e. computing a*b.

I brought up the example above to use it as a metaphor.

In your work, how can you tell whether a problem is more like the first question or the second? Are you presuming you have to do something that you don’t? Are you assuming something is logically necessary when it is only conceptually necessary?

When I’m stuck on a problem, I often ask myself whether I really need to do what I assume I need to do. Sometimes that helps me get unstuck.

Related post: Maybe you only need it because you have it

10 thoughts on “Maybe you’re doing more than you need to

  1. Frédéric Grosshans

    The median digit is between the 10th and the 11th, and therefore really easy to compute !

  2. No, it is not between the 10th and 11th digit. What if the product of two numbers is 11111111199111111111 (though this number is probably prime, I’m making a point)? The median is clearly 1.

    Great post! Thanks

  3. Hernán Echegoyemberry

    “Maybe you’re doing more than you need to”

    Or maybe we have “needs” beyong the final problem solution.

    For example need to discover, need to learn, need to create, etc..

    We learn in the path of solving, even after a suboptimal solution, after that “mistake”, we discover a better way and feel great to discover it so we rewrite solution, or if already released we think “Next time I will do it that way!”, so that’s a personal motivation, a personal need.

    Perhaps logical needs are for computers, our needs are different.

  4. Frederic, I believe you may have confused the /median/ digit with the middle digit. In the former (John’s) case, the full multiplication needs to be carried out and then the digits need to be sorted. In the latter, only the “lower” parts of the multiplication (analogous to the first digit case described above) need to be done to get to the “middle” digit, as anything above it (as a power of 10) is irrelevant.

  5. Hernán: Sometimes you can learn more by being lazy. Multiplying big numbers together is simple but tedious. Realizing that you don’t have to multiply them together takes insight. So does convincing yourself that full multiplication can’t be avoided.

    Avi: You are right. When I said median I meant median, not middle. It’s confusing because there are two notions of “middle” floating around. But even finding the middle digit is a fair amount of work. The lower parts of the multiplication involve every digit in both numbers. You could save some time by not completely carrying out the multiplication, but you still have to do about half the work.

  6. On the other hand, maybe the exact answer doesn’t matter. In that case, without doing any work at all, I’d guess that the answer to the second problem is 4.5, which is not so far off from the correct answer (== 3, I think).

  7. OK, I was intrigued. The answer, if I am not mistaken, is:

    19,263,325,425,427,217,401

    Which makes the median value “3” and there is no “middle” value as there are an even number of digits.

    Of course, that defeats the purpose of John’s original point, though :)

  8. Sid’s number, 11111111199111111111, is definitely not prime: there are two times 9 digits equal to one and two 9’s, and each number whose digits sum to a multiple of 9 is divisible by 9. :-)

    If you are curious, here are the factors:
    11111111199111111111
    = 9 * 1234567911012345679
    = 3² * 7² * 11 * 241 * 8963 * 25367 * 41801

    (Sorry for going slightly off topic.)

  9. Sylvia: there’s a possibly-even-easier way to see that it isn’t prime: it’s “obviously” a multiple of 11. (Because any number of the form 100..001 with an even number of digits is, and Sid’s number is a sum of those.)

Comments are closed.