Skip to content
Galactic algorithm

What Is a Galactic Algorithm?

December 2, 2026

A galactic algorithm is a method with the best known asymptotic running time whose advantage shows up only on inputs so large that no computer on Earth will ever run it.

Big-O notation compares growth rates and hides constant factors. Most of the time that bargain is a good one: an O(nlog⁡n)O(n \log n) sort really does overtake an O(n2)O(n^2) sort at sizes programmers see. A galactic algorithm is the case where the bargain fails. The exponent looks better, the proof is correct, and the input size where the new bound finally wins is larger than any input anyone will store.

The algorithms overview on this site states quantum speedups in that same big-O language. This page is the companion note on what an asymptotic win does and does not promise about the program you would actually launch.

Why the name is galactic

“Galactic” means the crossover sits at an astronomical scale, off any data set that exists on Earth.

Richard Lipton wrote the idea up on 23 October 2010, in the essay Galactic Algorithms. He had the phenomenon; Ken Regan supplied the word. A later version of the essay appears as a chapter, “David Johnson: Galactic Algorithms,” in their 2013 collection People, Problems, and Proofs. The image is deliberate. The algorithm is a real procedure, and the region of the universe where it is the fastest choice is somewhere you will not visit with a hard disk.

The name is a judgment about the crossover, and it can be revised. An algorithm called galactic in one decade can become ordinary code after the constants are cut or the machines grow. Low-density parity-check codes, invented by Robert Gallager in 1960, were out of reach for the hardware of that time and are now used in real communication systems. The examples below are ones that, as of this writing, remain on the far side of that line.

Where the speedup actually starts

The crossover is the smallest input size at which the asymptotically faster method uses fewer operations than the method everyone already runs.

Picture two matrix algorithms. Method A uses n3n^3 operations on an n×nn \times n matrix. Method B uses 109⋅n210^{9} \cdot n^{2} operations. Method B is O(n2)O(n^2) and method A is O(n3)O(n^3), so the textbooks will call B the faster algorithm. B spends fewer operations only once nn passes 10910^{9}. A matrix with a billion rows has 101810^{18} entries. You will run A, keep the smaller exponent as a theorem, and never allocate B.

Real galactic algorithms are this picture with the constant harder to see. It may be a leading factor nobody has computed tightly, a tower of exponentials hiding inside the big-O, or a construction so elaborate that a correct implementation is itself a research project. The definition only needs the conclusion: on every input you will meet, a “slower” algorithm is the fast one.

Matrix multiplication

The galactic algorithms for matrix multiplication are the methods that push the exponent below Strassen’s, down to a little above 2.37, with constants too large to use.

Multiplying two n×nn \times n matrices the schoolbook way costs on the order of n3n^3 arithmetic operations. In 1969 Volker Strassen showed a recursive scheme whose exponent is log⁡27\log_2 7, about 2.807, by multiplying 2×22 \times 2 blocks with 7 multiplications. Strassen’s algorithm is practical. Numerical libraries can switch it on for large matrices, and the size where it beats a tuned schoolbook product sits in the hundreds or thousands, far from the billions.

Don Coppersmith and Shmuel Winograd, in 1990, and the papers that sharpened their method, brought the exponent down to a little above 2.37. Each improvement is real, and each one is a small shaving of the exponent bought with a more elaborate algebraic construction. The constructions need enormous block sizes before the saved multiplications outrun the overhead. François Le Gall, writing in 2012 on a further improvement in this line, stressed that the huge constants make these algorithms impractical and of theoretical interest. That is the galactic regime: a better exponent, and a crossover past any matrix that fits in memory.

Strassen is the useful contrast inside the same problem. Lipton’s 2010 essay still grouped Strassen with the unused methods, because at that time it was unclear the crossover would matter. Practice has since moved Strassen onto the near side of the line and left the later exponent records on the far side. Same problem, two different verdicts, and the verdict tracks the crossover.

Integer multiplication

The galactic algorithm for integer multiplication is the O(nlog⁡n)O(n \log n) method of Harvey and van der Hoeven: it matches the conjectured best growth rate, and the constants keep it off the code path.

Schoolbook multiplication of two nn-digit numbers costs on the order of n2n^2 digit operations. Karatsuba, Toom–Cook, and then Fourier-transform methods, above all the Schönhage–Strassen algorithm, bring the exponent down, and those are the methods inside real big-integer libraries. Which one runs depends on nn. The handoff from one practical method to the next happens at thousands or millions of digits, sizes supercomputers and computer-algebra systems already see.

In 2019 David Harvey and Joris van der Hoeven gave an algorithm that multiplies in O(nlog⁡n)O(n \log n) bit operations, which is the growth rate people had conjectured was optimal. The proof routes the product through a high-dimensional Fourier transform. The big-O hides constants large enough that this is almost never the method a library selects. The result still does something the earlier algorithms could not: it shows that O(nlog⁡n)O(n \log n) is achievable. Harvey has said that further refinements might bring the crossover down toward numbers with billions or trillions of digits. That would still be a specialized regime, and it is a reminder that “galactic” describes the current constants, which later work is allowed to shrink.

The AKS primality test

The AKS primality test is a galactic algorithm because it is a deterministic, unconditional polynomial-time test, and every integer anyone checks is faster to test another way.

In 2002 Manindra Agrawal, Neeraj Kayal, and Nitin Saxena proved that primality is in P. Given an integer with nn bits, their test decides prime or composite in time polynomial in nn, with no randomness and no unproved hypothesis. The first version used a high power of nn. Later work, notably by Hendrik Lenstra and Carl Pomerance, brought the exponent down to about 6. A sixth-power polynomial in the number of bits is a theorem. It is also a program you would not start.

Software that needs a quick answer uses the Miller–Rabin test. It can be wrong, and the chance of a wrong answer on a composite can be driven below 10−10010^{-100} by repeating it, which is enough for every ordinary purpose. When a checkable proof of primality is required, implementations use elliptic-curve primality proving, which is fast in practice and has no proof that it always runs in polynomial time. AKS remains the algorithm you cite when the question is “is primality in P?” and the algorithm you skip when the question is “is this number prime?”

Why practice skips them

Practice skips a galactic algorithm because the input that would make it cheapest is larger than any input the machine can hold, or the procedure is too heavy to be the cheapest even when the exponent says otherwise.

Four costs sit outside the exponent.

  • The crossover. Until nn passes it, the older method does less work. If that threshold is 10910^{9}, or 1015110^{151} edges in the case of one famous linear-time minimum-spanning-tree algorithm, the threshold is the whole decision.
  • A constant that is really a tower. Some graph algorithms run in polynomial time for any fixed pattern graph, with a constant that grows as a tower of exponentials in the pattern. The exponent on the input looks mild. The constant is the runtime.
  • The cost of carrying the method out. A construction that searches an enormous algebraic object, or that is only known to exist, can be correct as a proof and unusable as code. Complexity of the paper counts, even when the big-O is kind.
  • Extra error, memory, or simplicity. Fast matrix methods can magnify rounding error. A simple algorithm with a worse exponent and a tiny leading factor often wins on wall-clock time, which is the quantity a user waits for.

Calling an algorithm galactic is compatible with admiring it. The label says where it wins. It assigns no blame for the proof.

Why they are still worth finding

A galactic algorithm is worth finding because it can move techniques, retire a false barrier, or become practical after the constants fall, whether or not anyone runs the original version.

Lipton’s essay lists the payoffs that justify the work. New machinery leaks out of the unused algorithm into later ones that do run. Claude Shannon’s random codes achieve channel capacity only at block lengths nobody would decode, and the decades of coding theory after them produced codes that approach the same limit at usable lengths. A galactic algorithm can also show that a conjectured barrier is false. Omer Reingold’s 2008 proof that undirected connectivity is in deterministic log-space is the landmark of that kind: the algorithm uses more time and memory than the ordinary search on every realistic graph, and it settles the complexity question those graphs were never going to settle by themselves.

The sharpest theoretical case is a problem whose complexity status is open. A polynomial-time algorithm for Boolean satisfiability whose degree was 100 would be useless on every formula anyone writes, and it would settle P versus NP. A polynomial-time factoring algorithm with a huge degree would change what cryptographers believe about factoring, long before any of them ran it. The value is the proof that the bound exists.

A different claim from “not built yet”

“Nobody runs it yet” and “galactic” describe different obstacles.

Shor’s algorithm factors integers in polynomial time on a fault-tolerant quantum computer. The integers people want factored, including cryptographic sizes, are exactly the sizes the algorithm is for. The obstacle is building a machine stable enough to finish that circuit. Resource estimates for those sizes are large and finite. They sit in engineering, in qubit counts and error correction, and the crossover against classical factoring is a size cryptographers already care about.

A galactic factoring method would be a different object: a polynomial bound whose hidden constant kept it slower than ordinary methods until the integer had an absurd number of bits, on a perfect machine. Both can be “never executed.” One is waiting on hardware at a useful size. The other wins only past every useful size. Grover search is in the first family as well. Its query drop, from on the order of NN checks to on the order of N\sqrt{N}, is a statement about calls to a checker, and the checker has to be an efficient circuit before the drop is a runtime. That is a constant-factor and implementation question inside a useful range of NN. It is the ordinary big-O bargain, and the galactic case is the bargain failing.

Where to go next