Mathematicians still don't know the fastest way to multiply numbers
scientificamerican.com
Mathematicians still don't know the fastest way to multiply numbers
1–10 of 152 posts
Re: Mathematicians still don't know the fastest way to multiply numbers
#2Re: Mathematicians still don't know the fastest way to multiply numbers
#3Re: Mathematicians still don't know the fastest way to multiply numbers
#4Re: Mathematicians still don't know the fastest way to multiply numbers
#5Does the article just end after describing the problem for me only? I am left wanting for more.
Re: Mathematicians still don't know the fastest way to multiply numbers
#6(ad + bc) = ((a + b) × (c + d)) – ac – bd.
First note this equation is more clearly be written as:
ad + bc = (a + b)(c + d) – ac – bd.
To see why this is so first expand (a + b)(c + d).
(a + b)(c + d) = ac + ad + bc + bd
now
(a + b)(c + d) − ac − bd = ac + ad + bc + bd − ac − bd
Hence
ad + bc = (a + b)(c + d) – ac – bd.
Re: Mathematicians still don't know the fastest way to multiply numbers
#7Does the article just end after describing the problem for me only? I am left wanting for more.
Re: Mathematicians still don't know the fastest way to multiply numbers
#8Re: Mathematicians still don't know the fastest way to multiply numbers
#9Re: Mathematicians still don't know the fastest way to multiply numbers
#10Take the first digit of the longer number. Multiply it by the shorter number and store the result. Take the second digit of the longer number. If it matches the first digit, do a lookup of the last result and use that, else multiply and store. Repeat.
There will be a maximum of 10 * (length of the shorter number) multiplies, because there are only 10 unique digits. After that every operation is a lookup.
You could even do a tiny optimization by skipping the multiplication for the zero digit.
Worst case, the two numbers are the same length, in which case it's O(n/2 * 10), which is a heck of a lot better than O(n log n).
What am I missing here?
EDIT to respond to the comments: in the article, they are only counting the number of multiplies in the O() value. They are not including the adds.