The Future of Mathematical Discovery: Code, Creativity, and the Rise of AI

The Future of Mathematical Discovery: Code, Creativity, and the Rise of AI

A new AI approach isn’t just solving math problems—it’s writing programs that discover new theorems, reshaping how we think about creativity in science.
YT
Yohannes Taye
May 15, 2025
4 min read

Large language models are no longer confined to conversation. Their latest role? Writing code that discovers new mathematical truths. In a bold leap forward, a new approach demonstrates how language models can generate programs that make genuine scientific discoveries, solving problems previously thought to be intractable without human insight.

Beyond the Limits of Human Search Mathematical discovery often demands exhaustive exploration across vast problem spaces. Some challenges in combinatorics or geometry require sifting through thousands—or even millions—of candidate structures, a task well beyond unaided human capacity. Traditional computational tools can help but often depend on rigid algorithms, limiting their scope and creativity.

Now, a hybrid method called FunSearch is rewriting the rules. Instead of searching for direct solutions, it searches for programs that generate solutions. These code-based representations, refined through iteration and evaluation, not only solve the problem at hand but often offer insight into its structure.

FunSearch: Searching for Functions At the heart of this system lies a simple yet powerful loop. An AI model proposes new snippets of code. These are then scored against a clearly defined evaluation function: how good is the code at solving a given mathematical problem? The best-performing programs are reused, modified, and re-evaluated in a feedback loop that continuously improves results.

This evolutionary process—enhanced by techniques like "best-shot prompting" and diversity-preserving program sampling—encourages the emergence of high-performing, interpretable algorithms. Crucially, the model doesn't need to be trained on the specific problem. It starts from generic patterns of code, gradually homing in on novel discoveries through experimentation.

Breakthroughs in Combinatorics The system was tested on the notorious cap set problem in extremal combinatorics. This challenge involves finding the largest possible subset of vectors in which no three elements sum to zero. For dimensions beyond six, no complete solutions were previously known. Traditional methods imposed strict structural constraints to narrow the search.

Credit: Tesfu Assefa

FunSearch took a different path. Using a greedy skeleton algorithm that relies on a priority function, it evolved code capable of generating larger cap sets than those previously found. In dimension eight, it surpassed the best-known construction, discovering a new cap set containing 512 vectors. Even more remarkably, the system didn't just provide the result—it generated an interpretable program capable of producing it, offering new mathematical insight into the problem's symmetry.

Refining the Strategy with Symmetry The model was then applied to a related class of problems in additive combinatorics, aiming to construct large admissible sets that preserve specific mathematical constraints. Again, the AI began with trivial heuristics and evolved them through iterative refinement. It produced admissible sets that not only improved known lower bounds on the cap set capacity but also revealed an unexpected structure.

Manual inspection of the resulting program exposed a symmetry: the solution treated groups of coordinates in a cyclically invariant way. Building on this discovery, researchers constrained the search to symmetric solutions—simplifying the problem space while uncovering even larger admissible sets. This interplay of machine suggestion and human insight illustrates a new collaborative model of mathematical discovery.

Practical Algorithms from Evolved Code FunSearch's capabilities extend beyond abstract mathematics. In the field of combinatorial optimization, it discovered heuristics for the classic bin packing problem. Here, the challenge is to fit items of varying sizes into the smallest number of containers.

The AI-generated code yielded heuristics that outperformed industry-standard algorithms like first-fit and best-fit on benchmark datasets. Notably, the evolved programs exhibited a counterintuitive strategy: instead of always filling the tightest bin, they prioritized bins that would leave more usable space for future items, thereby reducing long-term inefficiencies. Again, the emphasis on interpretable code proved invaluable in identifying and understanding these tactics.

Scaling and Robustness The success of this approach depends on a carefully designed infrastructure. FunSearch operates as a distributed system with asynchronous components: a central program database, code samplers powered by large language models, and evaluators that test candidate programs. These components work in parallel, enabling massive scalability while keeping resource usage efficient.

To maintain diversity and avoid getting stuck in local optima, the system employs an "islands" model: subpopulations of programs evolve independently before the worst-performing ones are replaced. Each iteration focuses on evolving the critical parts of a program while preserving known algorithmic structures, such as greedy templates.

A New Kind of Discovery FunSearch doesn’t just solve problems; it suggests new ways of thinking about them. Because it searches in the space of functions rather than brute-force outputs, it can offer compact, generalizable, and human-readable representations of complex solutions. This aligns with the concept of low Kolmogorov complexity—favoring solutions that can be described with shorter programs, which are often more elegant and insightful.

What began as an AI-assisted coding exercise has evolved into a model for machine-augmented creativity. By combining the generative power of language models with rigorous evaluation and evolutionary search, FunSearch is setting a precedent for how artificial intelligence can expand the boundaries of formal reasoning.

From the abstract to the applied, this paradigm invites a fundamental rethinking of how we explore, solve, and understand problems. It suggests a future where the frontiers of mathematics, science, and algorithm design are explored not by humans or machines alone, but by both in tandem—each enhancing the other’s strengths in a new symbiosis of discovery.

About the Writer

More from Mindplex

Keep reading

Three more ideas worth your time.

Browse Community

Discussion

Join the discussion

Sign in to share a response with the community.

Type @ to mention someone Type / or use + to add a block Highlight text, then choose Link
Loading editor

Comments cannot be edited after posting because they become part of the reputation record. Give yours a quick review first.

The idea of language models not just solving problems but writing the very code that leads to genuine mathematical discoveries is a whole new level of AI-assisted research.

This article is revolutionizing mathematical discovery by generating programs that solve complex problems and uncover new theorems.

From the abstract to the applied, this paradigm invites a fundamental rethinking of how we explore, solve, and understand problems

aa

abel ashenafi

1 year ago

Exciting and terrifying right? FunSearch shows AI's potential to push the boundaries of human knowledge, but also highlights how quickly machines are evolving beyond predictable programming. The future of human-AI collaboration looks revolutionary—if we can guide it wisely.

An interesting look at how AI is bringing new insights into mathematics through interpretable, code-driven discoveries, resulting in a new era of scientific collaboration between humans and AI.

DM

Dagim Mesfin

1 year ago

This article is very comprehensive and groundbreaking as it explores a completely new way of looking at the problem itself.

ld

liya daniel

1 year ago

I love math and AI, so that article was a treat. FunSearch feels like a mathy treasure hunt with code.