1
$\begingroup$

I'm making a programming project for learning purposes, in which I try to calculate powers of very large numbers in as short of a time as possible.

One thing I could do is to try to do multiplication of two numbers without using any intermediary values. I would suppose such an algorithm would traverse the digits from the most significant to the least.

What is a good algorithm for multiplying two integers without using any intermediary values?

(Note: I also posted this question, in a more programming oriented form, over at Stack Overflow: https://stackoverflow.com/questions/8408139/in-place-integer-multiplication)

  • 0
    What's the point of not using intermediate values? Is memory at a premium? You should at least have enough space to store the result, and the conventional way of multiplying uses little more than that (if you're really strained, you could reuse the lower order digits of one multiplicand after it has been taken into account). Your question sound like asking to add up $n$ integers without using an accumulator variable.2011-12-07

1 Answers 1