Partition Numbers: Seeing Patterns Others Couldn't
How Ramanujan stared at a handwritten table of partition numbers and saw divisibility patterns nobody else had noticed
In 1918 Ramanujan looked at a handwritten table of partition numbers computed by Percy MacMahon and noticed three exact divisibility patterns that no one else had seen. This lesson walks through what a partition is, how Ramanujan's eye caught the patterns, and why the congruences he found became a launching point for modern analytic number theory.
Partition Numbers: Seeing Patterns Others Couldn't
In a small set of rooms at Trinity College Cambridge, in the late winter of 1918, Srinivasa Ramanujan sat with a long handwritten table spread across his desk. The table had been built up by Major Percy MacMahon, a retired British army officer turned combinatorialist, working at his desk for months on end. It listed, for every whole number from one to two hundred, the count of ways that number could be split into a sum of smaller whole numbers. The numbers in the right hand column grew at a frightening pace. By two hundred the count was nearly four trillion. Ramanujan ran his finger down a single column. Within a few sittings he announced three rules nobody had spotted in the twenty years the table had existed. MacMahon, who had written every number in the table by hand, checked the rules row by row. They held. The story of how Ramanujan saw what no one else had seen begins with the simplest possible question.

What Is a Partition
Take the number four. In how many ways can you write it as a sum of positive whole numbers, if order does not matter?
- 4
- 3 + 1
- 2 + 2
- 2 + 1 + 1
- 1 + 1 + 1 + 1
That is all of them. Five ways. Mathematicians write this fact as p(4) = 5, where p is the partition function. Partitions are one of the simplest objects you can define in all of mathematics. A child can understand the question. And yet the partition function is one of the most difficult sequences to compute in closed form, and the story of how it was finally understood runs straight through the mind of Srinivasa Ramanujan.
The Numbers Grow Fast
The partition function starts quietly. p(1) = 1, p(2) = 2, p(3) = 3, p(4) = 5, p(5) = 7, p(6) = 11. But it does not stay quiet. By p(10) the value is already 42. By p(50) it is 204,226. By p(100) it is 190,569,292. By p(200), the value is 3,972,999,029,388. The numbers grow roughly like the exponential of the square root of n, and there is no simple formula that gives you the next value from the previous ones. Unlike the Fibonacci numbers, which have a clean recurrence, the partition function has to be built up the hard way: either by listing the partitions directly, which is combinatorially enormous, or by working with a generating function, which is a power series whose coefficients are exactly the p(n).
The generating function was known to Euler in 1748. It is a beautiful object that turns the combinatorial problem into an algebraic one, but it does not immediately give you the values. To get actual numbers you still have to multiply out the series, term by term, for as far as you can manage. At the end of the nineteenth century, the British mathematician Percy MacMahon took on this task. MacMahon was the master of combinatorial computation of his generation, and he spent months building up a table of p(n) for n from 1 to 200, by hand, one row at a time. The table was published and became the standard reference for work on partitions. It was also the table Ramanujan would eventually stare at in Cambridge in 1918.
What Ramanujan Saw
Ramanujan had arrived in Cambridge in 1914 at the invitation of G. H. Hardy. By 1918 he and Hardy were deep into a collaboration on the analytic side of partition theory, and Ramanujan had MacMahon's table on his desk. What Ramanujan did was what he always did with tables. He read the column.
He noticed that p(4), p(9), p(14), p(19), p(24), and every subsequent entry five rows apart, were all divisible by five. Not approximately. Exactly. He wrote the observation down:
p(5n + 4) ≡ 0 (mod 5).
Then he checked the table for similar patterns modulo seven. He found one.
p(7n + 5) ≡ 0 (mod 7).
Then he checked modulo eleven. He found a third.
p(11n + 6) ≡ 0 (mod 11).
Three exact divisibility rules for the partition function, each covering an entire infinite arithmetic progression. Ramanujan sent them to Hardy. Hardy did not believe them at first, because the patterns seemed arbitrary. Why exactly 5, 7, and 11? Why the specific offsets 4, 5, and 6? There was no obvious reason any of this should be true. Hardy checked them against MacMahon's table. Every entry Ramanujan had flagged was indeed divisible.
These three statements became known as the Ramanujan congruences, and they are among the most surprising facts in all of elementary number theory. MacMahon had produced the data himself and had never seen the patterns. Dozens of European mathematicians who had examined partitions after Euler had never seen them. Ramanujan looked at the column of numbers once and saw all three.
The Asymptotic Formula
The congruences were half of Ramanujan's partition work. The other half was the formula he and Hardy developed for the approximate size of p(n). The question was: if n is large, roughly how big is p(n)? The numerical evidence already suggested that the answer involved something like the exponential of a square root. Hardy and Ramanujan found the exact form. Their 1918 paper states that
p(n) ≈ (1 / (4n√3)) · exp(π √(2n/3))
as n grows large. This is the Hardy-Ramanujan asymptotic formula, and for n = 200 it gives a value accurate to within a few parts per thousand. More importantly, Hardy and Ramanujan showed how the approximation could be systematically refined. They developed a new technique, now called the circle method, that gave not just the leading term but a whole sequence of corrections. Twenty years later, Hans Rademacher would push the method all the way to an exact convergent series for p(n), meaning that there is now a formula you can use to compute p(n) directly from n with no combinatorial enumeration at all. The foundation of that formula is Ramanujan's work.
Why It Matters
The partition function looks like a pure curiosity. It is nothing of the kind.
First, the congruences Ramanujan discovered turned out to be the visible surface of a much deeper structure. Modern work by Ken Ono and others has shown that partition numbers satisfy infinitely many congruences of a similar kind, governed by modular forms and the theory of Hecke operators. The three Ramanujan noticed in MacMahon's table were the tip of an iceberg that took eighty years to fully chart.
Second, the Hardy-Ramanujan circle method became one of the central tools of modern analytic number theory. It is used on Waring's problem (how many cubes or fourth powers you need to represent a large integer), on Goldbach's conjecture (every even integer greater than two as a sum of two primes), and on prime gaps. Every major analytic number theorist of the twentieth century learned the circle method as a foundational technique, and it traces directly to the 1918 Hardy-Ramanujan paper.

Third, and most unexpectedly, partition numbers turn out to describe black holes. When the string theorists Andrew Strominger and Cumrun Vafa counted the microstates of a certain class of black holes in 1996, the counting problem reduced to evaluating a generating function whose coefficients are partition numbers. The growth rate that Hardy and Ramanujan derived in 1918 is the same growth rate that controls the entropy of a black hole. The bridge from a handwritten table in Cambridge to the thermodynamics of spacetime runs through Ramanujan's partition work.

What makes this lesson specifically Indian, rather than a generic piece of twentieth-century number theory, is the quality of insight that produced it. Ramanujan did not derive the congruences. He saw them. The Indian tradition has a word for this kind of direct, sudden, non-discursive apprehension: pratibhā. It is the same word the aesthetic tradition uses for a poet's flash of inspiration, and the grammarians used for a linguist's sudden grasp of a rule that covers a thousand cases at once. Ramanujan read a table in 1918 and exercised pratibhā on it. Three facts that had been sitting in plain sight for twenty years became visible. That is the whole story, and it is characteristically his.
Key figures
Srinivasa Ramanujan
1887 to 1920, Erode and Kumbakonam (Tamil Nadu) and Trinity College, Cambridge
Percy Alexander MacMahon
1854 to 1929, United Kingdom
Nārāyaṇa Paṇḍita
c. 1340 to 1400 CE, North India
Case studies
MacMahon's Table: The Data That Had Been Hiding Ramanujan's Congruences in Plain Sight
In the 1890s and early 1900s, Percy MacMahon sat down and, by hand, computed the partition function p(n) for every integer from 1 to 200. The computation used Euler's generating function, which is the product (1-x)(1-x²)(1-x³)... inverted, and MacMahon had to multiply the series out one term at a time, carrying hundreds of digits of precision, checking each coefficient against the next to make sure the recursion was consistent. It was a task of months. When the table was finished, MacMahon published it, verified it against independent computations, and used it as the reference data for his two-volume Combinatory Analysis in 1915. It was a remarkable piece of work by the leading combinatorialist of his generation. And for twenty-plus years, nobody looking at it noticed that the entries at positions 4, 9, 14, 19, 24, ... were all divisible by five. Nobody noticed that the entries at 5, 12, 19, 26, ... were all divisible by seven. Nobody noticed that the entries at 6, 17, 28, 39, ... were all divisible by eleven. The data was correct, the patterns were sitting in plain view, and the finest combinatorial eye in England had passed over them without comment. In 1918 Ramanujan picked up the same table in Cambridge, read down the column with the eye of a Kumbakonam Brahmin who had spent his youth turning over numerical relationships for their own sake, and saw all three patterns.
This is the clearest single illustration of the difference between knowing a body of data and seeing the patterns inside it. MacMahon had produced the numbers. He was a meticulous computer, a careful bookkeeper of coefficients, a master of the generating-function machinery that lay behind the values. What he did not have was the pratibhā to read the column. Ramanujan did. The Indian aesthetic and grammatical tradition had a vocabulary for exactly this distinction: the difference between a savant who holds the details in memory and a seer who apprehends the underlying rule. Ānandavardhana's Dhvanyāloka, writing about poetry eleven centuries earlier, had named the capacity pratibhā and described it as the faculty that reveals a new meaning where nothing had seemed to be present. The Hardy-Ramanujan story of the partition congruences is a mathematical instance of a pattern the Sanskrit tradition had already been analyzing for a thousand years.
Ramanujan's three congruences were confirmed by Hardy against MacMahon's table and published in 1919 in Some Properties of p(n), the Number of Partitions of n. They opened an entirely new line of research on how partition numbers behave modulo small primes. Over the next century, mathematicians extended the story enormously. G. H. Hardy, A. O. L. Atkin, Freeman Dyson, and eventually Ken Ono showed that the three congruences Ramanujan noticed are the visible tip of an infinite family, and Ono proved in 2000 that partition congruences exist for every prime greater than three. The table MacMahon had computed by hand was, it turned out, only the barest surface of the structure inside the partition function. Ramanujan's eye had glimpsed that depth in a single reading session.
Data and insight are different capacities. A careful computation can produce enormous amounts of correct data and still miss the most important facts it contains. The discipline of reading your own tables, of asking what patterns might be hidden inside the output, is a separate skill from the discipline of producing the output in the first place. MacMahon was excellent at the first. Ramanujan was unmatched at the second. Any working researcher who produces numerical data owes the data the favour of a long, attentive stare before moving on to the next computation.
MacMahon's 1915 table lists p(n) for n from 1 to 200, with p(200) = 3,972,999,029,388. Ramanujan's three congruences each hold for every value of n in the table and for every value beyond, covering infinitely many entries that had never been computed when he stated them.
Nārāyaṇa Paṇḍita's 1356 Partitions: Ramanujan's Five-Hundred-Year-Old Indian Ancestor
In 1356 CE, the mathematician Nārāyaṇa Paṇḍita completed a large treatise called the Gaṇita Kaumudī, 'the moonlight of mathematics'. One of its sections, called the aṅka-pāśa, the 'net of digits', deals with a family of problems that ask how many ways a given number or sum can be constructed from a specified pool of parts. The chapter gives named rules, worked examples, and general formulas for several cases: how many ways to split a sum among distinct parts, how many ways to split it among parts drawn from a restricted list, how many ways to split it using parts that must add to a given total. In modern vocabulary, Nārāyaṇa is treating partition-type enumeration problems as a recognized subject of mathematical study. He gives the category a Sanskrit name, vibhāga, and he works through the main sub-cases with the same seriousness Euler would bring to the same problem four hundred years later. The Gaṇita Kaumudī was not an isolated effort. It was the late-medieval summit of a tradition that went back to Piṅgala in the second century BCE, and it was taught and commented on in Sanskrit mathematical circles for the next several hundred years.
Ramanujan's work on partitions in 1918 is often presented as the arrival of something completely new in Indian mathematics. It was nothing of the kind. It was the continuation of a line of inquiry that had been active in the Sanskrit tradition for two millennia. Piṅgala had asked how to enumerate metrical patterns of a given length. Mahāvīra in the ninth century had worked on combinatorial counting as part of the Gaṇitasāra-saṅgraha. Nārāyaṇa in the fourteenth century had given partition problems their own name and their own rules. By the time Ramanujan, educated in Kumbakonam in a Brahmin household with a living Sanskrit mathematical culture, looked at MacMahon's table in Cambridge, he was bringing a fifteen-hundred-year-old habit of asking how to count distinct arrangements to bear on a modern European data set. The originality was in the specific result he saw, not in the fact that a mathematician from his background was looking at partitions.
Scholarly recognition of Nārāyaṇa's partition work is relatively recent. The Gaṇita Kaumudī was first critically edited and published by Padmākara Dvivedī in the 1930s and has been studied in depth by historians of Indian mathematics only in the last fifty years. Its significance for understanding the background of Ramanujan's work is still being absorbed. What is clear is that Indian combinatorics did not arrive with Ramanujan. It culminated in him. The five-hundred-year gap between the Gaṇita Kaumudī and the Hardy-Ramanujan paper of 1918 is a quiet continuity, not a rupture, and the Sanskrit vocabulary of vibhāga and saṃkhyā that Nārāyaṇa used is still the natural terminology for the same problems in modern Indian mathematical writing.
A great discovery is almost never an isolated event. It is the visible peak of a tradition that has been building under the surface for a long time. Ramanujan's partition congruences feel like they came out of nowhere because the English-language history of combinatorics starts its story with Euler and forgets what was happening in Sanskrit five centuries earlier. Knowing the deeper history is not an act of chauvinism. It is an act of accuracy. It lets you see the discovery as the last step of a long climb instead of a miracle with no antecedents.
The Gaṇita Kaumudī of Nārāyaṇa Paṇḍita was composed in 1356 CE, 562 years before the Hardy-Ramanujan paper of 1918. Its aṅka-pāśa chapter devotes more than thirty verses to partition-type problems, with worked examples counting the ways to split specific small numbers into parts drawn from various restricted sets.
Black Hole Entropy: Ramanujan's Partitions at the Edge of Spacetime
In 1996, the string theorists Andrew Strominger and Cumrun Vafa published a paper titled 'Microscopic Origin of the Bekenstein-Hawking Entropy'. The paper solved a problem that had been open for twenty years: why is the entropy of a black hole exactly one quarter of the area of its event horizon measured in Planck units? Hawking and Bekenstein had derived the formula from thermodynamic arguments in the 1970s, but nobody had been able to count the underlying microstates and recover the number from first principles. Strominger and Vafa did the count for a specific class of supersymmetric black holes. The counting problem turned out to reduce to evaluating a generating function. The coefficients of that generating function were partition-like numbers. The growth rate of those coefficients as the relevant integer becomes large was exactly the exponential-of-a-square-root behaviour that Hardy and Ramanujan had derived for the partition function in 1918. The entropy of a black hole, in other words, is described by an asymptotic law whose specific form Ramanujan had written down seventy-eight years earlier while looking at MacMahon's table in Cambridge.
This is the most spectacular delayed pay-off in twentieth-century mathematics. Ramanujan was not thinking about black holes. He was looking at a handwritten table of p(n) and noticing that three divisibility rules held for infinitely many entries. The physical interpretation of the asymptotic formula he derived with Hardy would have made no sense to him, because black holes would not be conceived as physical objects until Schwarzschild's solution in 1916 was reinterpreted decades later, and the thermodynamic picture would wait until Hawking and Bekenstein in the 1970s. Yet the mathematical object Ramanujan had in hand in 1918 turned out to be the precise instrument needed to count states of spacetime itself. The Indian intellectual tradition's insistence that mathematical truth is independent of its physical interpretation, that numbers have a reality which any physical phenomenon may or may not choose to express, is borne out in this story with particular vividness. Ramanujan, who said that an equation had no meaning unless it expressed a thought of God, turned out to be right in a way he could not have anticipated. The thoughts of God included the combinatorics of black holes.
The Strominger-Vafa calculation and its successors have made partition-like counting one of the central tools of modern string theory and quantum gravity. Every subsequent advance in the microscopic interpretation of black hole entropy, from the Wald entropy formula to the higher-derivative corrections studied by Sen and Mandal, rests on a version of the same partition-counting framework. The Hardy-Ramanujan asymptotic formula remains the leading-order result for the entropy of the simplest BPS black holes, and the full Hardy-Ramanujan-Rademacher expansion is used to compute the higher-order quantum corrections. Ramanujan's partition work, which looked in 1918 like an elegant but specialized piece of number theory, is now a foundational component of our best theoretical account of how the universe stores information in its strangest gravitational objects.
A sufficiently deep mathematical result can wait. Ramanujan's partition work sat quietly for most of a century before it became a basic ingredient in string theory. The waiting did not diminish the result. If anything it confirmed the Indian conviction that genuine mathematical truth has a life independent of the applications that eventually find it. When you discover something deep, you do not need to know in advance where it will be used. You only need to know that it is real, and the history of Ramanujan's partition function is one of the strongest arguments for that faith that any twentieth-century mathematician has left us.
The Strominger-Vafa paper 'Microscopic Origin of the Bekenstein-Hawking Entropy' appeared in Physics Letters B 379 (1996), pages 99 to 104. Its counting argument reduces to evaluating the coefficients of a modular-form generating function whose large-n asymptotics are controlled by the Hardy-Ramanujan formula of 1918. Ramanujan's result was therefore cited, in effect, 78 years after its publication as the leading-order answer to a fundamental question in quantum gravity.
Historical context
The Early Twentieth Century and the Indian Combinatorial Inheritance
Ramanujan's education took place in Kumbakonam, Tamil Nadu, in a Smārta Brahmin household that preserved a living tradition of Sanskrit learning. Although he was formally trained in colonial English-medium schools and learned most of his mathematics from G. S. Carr's Synopsis of Elementary Results in Pure and Applied Mathematics, the cultural substrate he grew up in was the classical South Indian Brahmin environment in which numerical relationships were objects of contemplation. The family goddess Namagiri of Namakkal was, in Ramanujan's own account, the source of many of his formulas. He regularly said that dreams of Namagiri brought him results he would then write down in the morning. This kind of testimony is not straightforwardly assimilable into the working framework of European analytic number theory, but it is perfectly coherent within the Indian aesthetic and philosophical tradition of pratibhā, the spontaneous insight that is the creative faculty behind poetry, grammar, and mathematics alike. Ramanujan was practising pratibhā in Kumbakonam before Hardy invited him to Cambridge, and he continued to practise it in the Trinity College common room in 1918.
Ramanujan's partition work is the clearest single illustration in the history of twentieth-century mathematics of what it means for a mind trained in one tradition to apply itself to another tradition's data. The congruences were sitting in MacMahon's table for twenty years, unread. A mathematician carrying the habits of a Brahmin household in Kumbakonam saw them in one session. The asymptotic formula he derived with Hardy went on to become the foundation of analytic number theory. A century later, the same formula is used to count the microstates of a black hole. Every step in this chain has been important to the field, but the pivotal moment is the original act of pratibhā, the reading of the column that nobody else could read.
Living traditions
The partition function remains one of the most actively studied objects in analytic number theory more than a century after Ramanujan's congruences. Ken Ono and his collaborators have shown that the three patterns Ramanujan noticed are the beginning of an infinite family that extends to every prime greater than three. Modular forms, Hecke operators, and the theory of mock theta functions, which Ramanujan himself seeded in his final letters to Hardy, have grown into central areas of modern mathematics. The Hardy-Ramanujan circle method continues to power the best available attacks on Goldbach's conjecture and on Waring's problem. Partition asymptotics underpin the string-theoretic counting of black hole microstates and appear in statistical mechanics, combinatorial optimization, and quantum field theory. On the Indian side, National Mathematics Day, the SASTRA Ramanujan Prize, and the Ramanujan-IAS Fellowship have made Ramanujan the single most visible figure in Indian scientific culture. His house on Sarangapani Sannidhi Street is a place of pilgrimage for mathematicians from every continent. The partition function that once sat in plain view in MacMahon's table is now one of the best-understood, most-applied, most-celebrated objects in the whole of mathematics, and the story of how that happened is, at its pivot, the story of a single man reading a column of numbers in Cambridge in 1918.
- Sarangapani Sannidhi Street, Kumbakonam: Ramanujan's childhood home on Sarangapani Sannidhi Street in Kumbakonam has been preserved as a small museum by the Shanmugha Arts, Science, Technology and Research Academy (SASTRA) and the Government of Tamil Nadu. The house is a simple traditional Tamil Brahmin dwelling with a front verandah, inner courtyard, and small rooms behind, and it is where Ramanujan filled the famous slate with his first computations, where he read Carr's Synopsis, and where his family goddess Namagiri is said to have appeared to him in dreams. The street is named for the adjacent Sārangapāṇi temple, one of the major Vaiṣṇava shrines of the Kaveri delta, which Ramanujan visited throughout his youth.
- Namagiri Temple, Namakkal: The Namagiri Thāyār shrine at Namakkal is the temple of Ramanujan's family goddess, the deity he credited throughout his life with the mathematical results that came to him in dreams. The shrine sits on a rocky outcrop in central Namakkal alongside the older Narasimha temple, and the Namagiri Thāyār murti is one of the most revered goddess forms in Tamil Vaiṣṇava practice. A mathematical visitor to the temple is doing something Ramanujan himself did many times: going to the goddess and asking, in effect, for pratibhā. The pilgrimage is part of the living tradition out of which his mathematics emerged.
Reflection
- Think of a data set, a spreadsheet, a report, a conversation log, anything, that you have generated or received in the last month. Have you actually read it the way Ramanujan read MacMahon's table, looking for patterns that were not the point of the data? What would it cost you to do that once?
- Ramanujan said that an equation had no meaning for him unless it expressed a thought of God. Is it possible to do good mathematics, or good work of any kind, without some version of that sense, or is the belief that one's material is sacred a precondition for seeing deeply into it?
- Is a mathematical pattern discovered or invented? Ramanujan said the congruences were already there in the table, waiting. Nārāyaṇa Paṇḍita, five centuries earlier, said that counting partitions was a distinct kind of knowing. If both are right, what is it that a mathematician is actually doing when they state a new theorem?