For the multiplication of two $n$ digit numbers, the best known algorithm has complexity $O(n \log n)$. Has it been proven that this is the best possible, or that an algorithm $O(n)$ is not possible?
There is a conditional $\Omega(n\log n)$ lower bound due to Afshani, Freksen, Kamma, Green Larsen, Lower Bounds for Multiplication via Network Coding.
No nontrivial lower bound for the multiplcation is known (clearly, it is $\Omega(n)$) and David Harvey himself does not know if a complexity of $O(n\log(n))$ is the best possible: in his own words: "in this sense, our work is expected to be the end of the road for this problem, although we don't know yet how to prove this rigorously". See also the original paper al page 1: "If the Schönhage–Strassen conjecture is correct, then Theorem 1.1 is asymptotically optimal. Unfortunately, no super-linear lower bound for $M(n)$ is known."
You could do it in O(1), kinda...
- Precompute a lookup tables of log and log-1 values.
- Get absolute values
- Look up the two numbers,
- Add the log of the two numbers
- Look up log-1
- Change to negative if one of the original numbers was negative.
If you work with 32bit signed ints then that would only take 8gb of of memory for the first table (312 x 4bytes) and 16gb for the second (312 x 8bytes). (It may be possible to compress them a bit for the small logs and log-1s)
Quite a bit of memory yes, but readily available on consumer grade laptops.
If you have lots of 32 signed ints it may be worth the large contact overhead?!