frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Mathematicians still don't know the fastest way to multiply numbers

https://www.scientificamerican.com/article/mathematicians-still-dont-know-the-fastest-way-to-multiply-numbers/
86•beardyw•5d ago

Comments

bombela•5h ago
Does the article just end after describing the problem for me only? I am left wanting for more.
kadoban•5h ago
It's an open question in mathematics/CS, that's all we know. If you want to know more, get to mathing :)
woggy•4h ago
Ask Sol 5.6 for the answer
wolfi1•3h ago
if you want a little more in depth explanation of the whole multiplication thing Ican recommend TAOCP volume 2. it has a section called 'How fast can we multiply?' it should provide more insight. there is a paper from djb (Daniel J Bernstein),which I can also recommemd: https://cr.yp.to/lineartime/multapps-20080515.pdf
Anduia•2h ago
Scroll down, there is a huge ad but the article continues.
qingcharles•5h ago
Amazed I hadn't heard of this before. Would be interesting to see if they can prove that they have discovered the fastest at O(n × log n) or whether there is more still to come.
pfdietz•4h ago
Lower bounds are really hard.
pgreenwood•4h ago
I don't think the article did a great job with their two digit illustration. They simply state:

(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.

jordigh•4h ago
Erm, I'm not sure you clarified anything other than removing one pair of spurious round brackets that who knows why they're there in the source material.

There are other weird formatting things in this article, which I blame on AI. I don't think the whole article was written by AI, but the copy-editing and formatting looks like an AI messed up things, such as those pointless round brackets or the inconsistency of multiplication (sometimes there is a × sign, sometimes there isn't), or this:

> have suspected that O(n²) was an inherent speed limit for multiplication. The celebrated Soviet math professor Andrey Kolmogorov posed the O(n^2)

The AI can't decide on notation.

estetlinus•1h ago
The AI is just like me, then.
jmalicki•4h ago
I have actually had a ton of success using Strassen matrix multiplication kernels with extra structure in custom CUDA kernels (e.g. a covariance matrix is symmetric positive definite, or can be represented with Cholesky, and that comes up in a ton of useful computation). It's been a couple of years, but IIRC I would find it would start to win over the standard kernels at ~n>2500 or something (and in addition to Strassen was also exploiting the explicit structural constraints of the matrix, so not a completely fair comparison).
TimorousBestie•4h ago
If you’re interested, I found https://arxiv.org/abs/2505.09814v1 to beat Strassen for medium-sized and larger covariance matrices. YMMV of course. Takes a little adjustment for XX^H but it’s not so bad.
jmalicki•3h ago
Thanks!
ccleve•4h ago
Ok, maybe I don't understand the problem, but it seems obvious that it should never be greater than O(min(n1, n2) * 10), where n1 and n2 are the lengths in digits of each argument, and assuming we are multiplying decimal numbers.

Take 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.

pfdietz•4h ago
Adding up those n1 numbers, each at least n2 digits long, takes O(n1 * n2) time.
aaronbwebber•4h ago
your algorithm for multiplication involves doing multiplication?
eru•3h ago
You might want to learn about recursion. It'll blow your mind.
floxy•3h ago

             1234567890 
           x     111111
           ------------
             1234567890
            12345678900
           123456789000
          1234567890000
         12345678900000
      + 123456789000000
      -----------------
    137,174,072,825,790 
...looks like O(n^2).
hankbond•4h ago
Shout out to a cookie ToS modal on top of an email newsletter modal on top of the article. What a great way to make me immediately click back and leave the site.
Terr_•3h ago
Shout-out to javascript disabled by default :)
derwiki•2h ago
And Safari Reader Mode!
MarcelOlsz•3h ago
Terrence Howard already figured this out.
jdw64•3h ago
I already know about fast multiplication algorithms, but it seems there's still no proof that a faster algorithm absolutely cannot exist. In other words, we don't know where the limit is yet.

If that gets proven, would programming multiplication algorithms become faster? I'm curious

TimTheTinker•3h ago
The O(n log n) algorithm is galactic (only becomes more efficient when multiplying massive numbers)

So for numbers we normally work with, no. Maybe with cryptographic operations though.

groundzeros2015•2h ago
Matrix multiplication is constantly getting improved but these methods aren’t improvements on practical implementation.
ChocMontePy•2h ago
Mirror in Yahoo News:

https://tech.yahoo.com/science/articles/mathematicians-still...

avmich•2h ago
We can likely use different number representations for faster results. E.g. numbers in the form of coefficients to prime factors can be multipled at O(n) time, right?
necovek•2h ago
You mean like those guaranteed-always-compresses-by-at-least-one-bit algorithm patents gzip page made fun of?

In your case, doing prime factoring is where the cost would be, wouldn't it?

zeroonetwothree•2h ago
True but addition becomes a lot less efficient in this representation :)
WCSTombs•52m ago
To make both addition and multiplication O(n), you can store numbers as their residues modulo a bunch of different primes and appeal to the Chinese Remainder Theorem. However, then size comparison becomes difficult.
charcircuit•2h ago
How is it measured? A lookup table takes 1 step to find the answer of a multiplication.
blovescoffee•2h ago
because you're looking up a result not solving for it
charcircuit•2h ago
You solve it by looking it up.
bmacho•1h ago
This would be the solution for any problem/algorithm, wouldn't it?

Factorize big numbers, sort an array, beat stockfish at chess, create a SOTA microkernel OS from English description. All O(1) with lookup table!

It's not how complexity works.

hcs•17m ago
An algorithm is a finite sequence of instructions, and so can't include an infinite table. More generally, https://en.wikipedia.org/wiki/Effective_method
JoelJacobson•2h ago
Back in 2024, I was trying to optimize PostgreSQL's NUMERIC data type, which is base-10000, using Karatsuba. The problem of finding the optimal threshold of when to switch to Karatsuba turned out to be really hard, since it depends on the size of both factors combined. After some hundreds of hours, I gave up, and started thinking about if there could be a simpler solution. I came to think about another idea I'd had before but abandoned, about 64-bit modernizing the digit base from 10k to 100M, but that would be a challenge due to existing data on disk. Desperate of finding a solution, I wondered if it could be fast enough to do on-the-fly conversion back and forth between base-10k and base-100M, and then realized that, yes, of course, it will be fast already for quite small N (testing shows already between 3-6 base digits). The trick basically reduced the N in O(N^2) into half, i.e. O((N/2)^2), with some O(2*N) cost for the conversion back and forth.

I had a lot of fun hacking on this idea together with the maintainer of the NUMERIC data type, and after two months the patch finally was ready and got committed:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit...

JoelJacobson•2h ago
Here is the full pgsql-hackers mailing list thread where you can follow our work from initial idea to commit: https://www.postgresql.org/message-id/flat/9d8a4a42-c354-41f...
sureglymop•12m ago
Love this, thank you for providing the context!
wormslayer666•
NetMageSCW•1h ago
Paywall.
stfnon•1h ago
back in 2008 I had actually a ton of success using Strassen turboplicattion kernels with some extra custom CUDA lora (its more for Cholay) than anything else but it worked. Obviously I was forbidden to use it due to interest of shana.
Davidzheng•40m ago
The complexity is obviously nlogn - it's just hard to prove (this comment is only somewhat serious)
Davidzheng•39m ago
Maybe they should reduce sorting to multiplication lol
monster_truck•37m ago
On some level I feel like we aren't even really trying. This stuff is so damn dry, though.

(warning, I refuse to like math and address it on my own terms, proceed further at your own peril)

Started looking into exact integer matrix multiplication, wanted to use it for some differential bullshit to find whatever they call the magic numbers that simplify a lot of complicated work into virtually no work for suspension/drivetrain/grip simulations at scale

To my surprise rocm didn't even usefully accelerate it! I said there is no fuckin way a 7900XTX is only good for 0.5 TOPS when working with 64 bit integers. I knew RNS/CRT/GEMM was a thing which led me to this https://github.com/RIKEN-RCCS/GEMMul8. Nothing pisses me off more than CUDA having something ROCm doesn't. So I told the models to try and fill the moat in with concrete. Think I got up to almost 3 TOPS before I stopped, and there are some pretty absurd wins for int32/other shapes.

Here's the slop https://github.com/doublemover/RNS8, I haven't cleaned it up or anything.

Life has gotten in the way so I had to set it down, and fighting the air conditioning when its "95 feels like 107" and the sky is filled with smoke is... not cool. I will finish it after summer. The HotAisle guy is a legend and hooked it up with some credits so I will be able to do the same for CDNA3, it at least compiles and runs but it has not been optimized/tested much yet.

Started with ChatGPT 5.5 but it sucked. I'm not paying $200/mo to play reset bingo while they figure out their bugs, especially without 20x. They lit my last $50 on fire in like 20 minutes with no remediation past "keep paying and you'll get more resets". Don't sleep on Deepseek, V4 Pro was responsible for the biggest leaps and it cost all of $15. It's genuinely great. The only way I'd go back to a closed model is if it was completely free. It will be fun to see how much better models are in a few months.

ccleve•3h ago
Once the longer number starts repeating digits, then it's not n^2 anymore. Multiplies get replaced with lookups. And we're only counting the multiplies. That's all they counted in the article. Not the adds, not the shifts.
CaptainNegative•3h ago
They don't count the additions or shifts because they're both linear time operations, and thus provably at least as fast as multiplication (both in an asymptotic and exact sense). In any case where multiplication is super-linear, this means that addition and shifting are are not the temporal bottleneck at any stage in the algorithm where you have a constant number of those operations surrounding at least one multiplicative recursive call (on numbers of similar magnitudes).

If additions were truly free, an even easier optimal algorithm would just be repeated addition involving zero multiplications.

cvz•1h ago
The complexity of Karatsuba's algorithm, because it's a recursive one that gets "wider" at every level, is dominated by the width of that recursion. The top level always has a small number of operations, so we don't explicitly count them there, but the bottom has the truly huge number of operations that contribute to the algorithm's complexity, because each level of recursion dramatically increases the number of operations. Some number of those operations (most of them, in fact) will be single-digit additions.

Memoizing number-by-digit multiplication doesn't make multiplication O(1) because one must still do an N-digit addition (which is O(N)) for each digit.

chowells•1h ago
The slowest multiplications are always when the two numbers are about the same size... That is to say, the case you're talking about doesn't happen.
mgaunard•3h ago
You're missing the fact that "multiplying a digit with a number" is not a single operation.
ccleve•3h ago
No, that's taken into account.
evandijk70•3h ago
Not an expert, but I think the algorithm works for any base, not just 10. The python implementation uses base 2^30 for their multiplication. Base 10 is just a convenient illustration

The lookup table would not work for that case

pdpi•3h ago
You’re missing the O(1) space complexity.
svat•2h ago
By your reasoning, multiplying two numbers in binary involves no multiplication at all, because multiplying by 1 and multiplying by 0 are both trivial operations.

But obviously multiplying two n-bit binary numbers is not done in O(1) time, so "only counting the number of multiplies" is not a meaningful model, and not the model adopted by the researchers quoted in the article.

inkysigma•1h ago
The final time complexity for Karatsubas does account for the addition via the master theorem and gives you something less than n^2. It’s just in some sense the recursion is dominant so we add to the exponent. As a result, I think the article is just talking about counting multiplications since it’s in some sense the “expensive” operation in the both the recursive karatsuba and the regular grade school method.
SkiFire13•48m ago
> 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.

This simplification relies on the fact that after making a multiplication the cost of merging it with the result of another is always less than the cost of performing the multiplication, so it doesn't change the overall complexity.

This is not true in your proposed algorithm: a lookup is O(1), but merging is O(N), so you cannot do the same simplification and have to count the complexity of performing adds as well.

13m ago
A bit tangential, but the folks behind the GNU Multiple Precision Library (GMPLib) have the problem of choosing algorithms more or less fleshed out. They've got some fairly approachable manual pages[1] for the various algorithms they use as operand sizes scale up, where Karatsuba is only the second of six options in terms of operational complexity.

[1] https://gmplib.org/manual/Multiplication-Algorithms

Transcribe.cpp

https://workshop.cjpais.com/projects/transcribe-cpp
464•sebjones•7h ago•85 comments

Speech Recognition and TTS in less than 500kb

https://github.com/moonshine-ai/moonshine/tree/main/micro
434•petewarden•4d ago•57 comments

Searchable field-level encryption on Supabase with CipherStash

https://supabase.com/blog/searchable-field-level-encryption-with-cipherstash
31•dandraper•3d ago•11 comments

Codex Resets

https://codex-resets.com/
167•denysvitali•9h ago•120 comments

Better and Cheaper Than IPTV

https://github.com/stupside/castor
169•xonery•7h ago•43 comments

Mathematicians still don't know the fastest way to multiply numbers

https://www.scientificamerican.com/article/mathematicians-still-dont-know-the-fastest-way-to-mult...
86•beardyw•5d ago•55 comments

The Kimi K3 Moment

https://stephen.bochinski.dev/blog/2026/07/18/the-kimi-k3-moment/
365•sbochins•15h ago•400 comments

GPT-5.6 used a prompt to close a 30-year gap in convex optimization

https://old.reddit.com/r/math/comments/1uxj3cy/after_openais_cdc_proof_announcement_gpt56_used_a/
555•mbustamanter•19h ago•355 comments

Hardcore IndieWeb: Run your own website 100% independently for only $0.01/day

https://www.neatnik.net/hardcore-indieweb
153•cdrnsf•10h ago•93 comments

Scrying the AMD GFX1250 LLVM Tea Leaves

https://chipsandcheese.com/p/scrying-the-amd-gfx1250-llvm-tea
18•mfiguiere•3h ago•0 comments

Using self-hosted Umami for iOS app analytics

https://hjerpbakk.com/blog/2026/07/14/umami-for-apps
8•Sankra•4d ago•1 comments

If You Build It, They Will Come

https://www.benlandautaylor.com/p/if-you-build-it-they-will-come
394•barry-cotter•17h ago•135 comments

Making Software: How to make a font

https://www.makingsoftware.com/chapters/how-to-make-a-font
35•Garbage•4d ago•6 comments

Classic Amiga titles, free to download

https://amigafreeware.downer.tech/
110•doener•10h ago•16 comments

A Visual Catalog of Retro Macintosh Software

https://www.marciot.com/mac68k-visual-catalog/
36•zdw•1w ago•5 comments

Setting up your spare Mac for Claude Code to control, a step-by-step guide

https://ykdojo.github.io/claude-controls-mac/
226•ykev•16h ago•154 comments

I'm Making Strandfall, a Solarpunk Orienteering Larp

https://mssv.net/2026/04/29/im-making-strandfall-a-solarpunk-orienteering-larp/
149•surprisetalk•5d ago•18 comments

How the Elite See Rome

https://www.theatlantic.com/magazine/2026/08/rome-elite-tourism-imago-artis/687621/
3•bookofjoe•5d ago•1 comments

Goodbye, and Thanks for All the Bikesheds

https://queue.acm.org/detail.cfm?id=3818307
210•Ygg2•15h ago•208 comments

NYC may require landlords and realtors to disclose the use of AI in listings

https://petapixel.com/2026/07/16/mayor-mamdani-says-landlords-cant-secretly-use-ai-images-to-adve...
452•gnabgib•10h ago•202 comments

Elixir-lang.org has a new design

https://elixir-lang.org/
225•bbg2401•17h ago•126 comments

AI Mania Is Eviscerating Global Decision-Making

https://ludic.mataroa.blog/blog/ai-mania-is-eviscerating-global-decision-making/#fnref:3
189•subset•7h ago•71 comments

Gleam Is Now on Tangled

https://tangled.org/gleam.run/gleam
231•nerdypepper•16h ago•146 comments

Deepsec

https://github.com/vercel-labs/deepsec
24•handfuloflight•7h ago•0 comments

Fable 5 vs. GPT-5.6 Sol on an NP-Hard Problem: Does /goal help?

https://charlesazam.com/blog/fable-5-gpt-5-6-sol-goal/
236•couAUIA•21h ago•115 comments

Developing an Intuitive Sense of Scale

https://magworld.pw
28•vismit2000•4d ago•5 comments

Is this the end of the once-mighty GoPro?

https://amateurphotographer.com/latest/photo-news/going-going-gone-is-this-the-end-of-the-once-mi...
215•aanet•4d ago•474 comments

REO Trucks I4 4WD Pickup Truck Starts at $21,500

https://reotrucks.com
87•b_mc2•14h ago•136 comments

I built a browser-based P2P file transfer tool using WebRTC

https://airdows.com/
17•SamOkampo•6h ago•11 comments

Co-evolution of self-replication and function in a digital primordial soup

https://arxiv.org/abs/2607.09211
68•vicgalle_•11h ago•14 comments