THE MATHEMATICS OF “MSI: THE ANATOMY OF INTEGERS AND

Andrew Granville

Preface We begin, as in any mathematical paper, with definitions: Anatomy (a-nat-o-my) noun: The scientific study of the shape and structure of an organism and the inter-relation of its various parts. The art of separating the parts of an organism in order to ascertain their position, relations, structure, and . Forensic (fo-ren-sic) adjective: Relating to the use of science or technology in the investigation and establishment of facts or evidence. If you switch on your TV in the evening then, as likely as not, you will find yourself watching an episode of a popular detective show (set in various spectacular locations) in which surprisingly dapper forensic scientists turn up evidence using careful anatomical (and other) study so as to be able to identify and prosecute a heinous criminal. Sometimes a flatfooted detective is misled by the surface evidence to suspect one person, but then the forensic team, digging deeper, turns up details that surprise not only the easily misled detective but even you, the astute viewer. For example, two seemingly unrelated corpses are found, and our hapless detective believes that the crimes are unrelated, whereas the forensic investigators turn up conclusive proof that the two corpses were in fact twins. So what would happen if we put together a forensic team to investigate the anatomy of some of the most common mathematical objects, say of integers1 and permutations2? How would they analyze the constituent parts? Could they find a “forensic” way to compare them? And, if so, what conclusions could they possibly draw? Could they find enough uncontestable evidence to really “solve the crime”. Our script “Math Sciences Investigation: The Anatomy of Integers and Permuta- tions” was born of a desire to take this popular approach to a discussion of a topic that has long fascinated me, the extraordinary similarities between the fine details of the structure of integers and of permutations, that is the anatomy of the two, and to write an expository paper that “forensically” analyzes the two. In our script we develop the connection with anatomy and forensics to create a fantasy world where forensic detectives (loosely based on certain famous mathematicians) prove and interpret several of the key notions, eventually discovering some of the deep theorems in the subject. Our goal was to create drama that

1Integer (in-te-ger) (noun): positive or negative whole number. 2Permutation (per-mu-ta-tion) (noun): a re-arrangement of the elements of a set.

Typeset by AMS-TEX 1 2 ANATOMY 101

stands on its own, as well as being a vehicle for popularizing this corner of mathematics. We also took this as an opportunity to draw attention to several key cultural issues in mathematics.3

The mathematical objects to be studied Integers. The whole numbers 0, 1, 2, 3,... as well as −1, −2, −3,... together give the integers.A prime number is an integer ≥ 2 which is only divisible by 1 and itself. In other words n > 1 is a prime if, and only if, the only solutions to the equation n = a × b in positive integers a, b are n = 1 × n and n = n × 1. There are positive integers that are not primes, for example 6 = 2 × 3, but all positive integers can be factored into a product of prime numbers, and that product is unique (if we ignore the order in which we write the primes). This fact is known as The Fundamental Theorem of Arithmetic, and was identified as fundamental by the ancient Greek philosophers, appearing in Euclid’s Elements, a 4th century A.D. treatise. For example 12 = 2 × 2 × 3, and each of 2 and 3 are primes; there is no other way to factor 12 though, of course, we can write these factors out in a different order, for instance 12 = 2 × 3 × 2 and 12 = 3 × 2 × 2. The decomposition of an integer into primes cannot be broken down any further, so the primes are indeed the fundamental constituent parts of integers. Every integer is composed of them, and each integer is composed of a different set of primes (as long as you keep track of how often each prime appears in the decomposition). Therefore you can just as accurately identify an integer through its set of prime factors as through the integer itself. It’s like the DNA of the integer. In the script Emmy, on page 9, is the one to first note that integers contain prime factors:

Oh. It’s a prime, sir. It hasn’t decomposed, and there are more of them dispersed around Integer’s body.

and then that the primes identify the integer:

... primes are the fundamental constituent parts of integers, their genetic code, if you like. Any integer can be identified by the primes it contains ... which ones and how many of each type. So now it should be no problem ID-ing the corpse [integer].

Permutations. In the script we invent a snooker game, “clockwork colours”, to help explain what a is. There are N different coloured balls, and each of N people gets one of the balls. After one round the balls are again distributed to the N people, and a permutation describes the change in colour that each person experiences. To put this on a more mathematical footing, label the people, person 1 through person N, and label the ball each person has to start with the same way. After one round, person 1 gets the ball coloured σ(1) say, person 2 gets the ball coloured σ(2) say, etcetera. This map σ which re-organizes the numbers {1, 2, 3,...,N} is called a permutation. If we play with four people and person 1 gets colour 2, person 2 gets colour 4, person 3 again gets

3See the program for discussion of this. ANDREW GRANVILLE 3

colour 3 and person 4 gets colour 1, then our permutation σ on four elements is given by σ(1) = 2, σ(2) = 4, σ(3) = 3, σ(4) = 1. We can represent this map as 1 → 2 → 4 → 1 and 3 → 3. So, a permutation is a re-arrangement of N objects, in that every object is mapped to another one of the objects, and is mapped from another one of the objects.4 For example, if N = 2, we could have 1 → 1 and 2 → 2, which is called the identity map; or 1 → 2 and 2 → 1 which we can represent as 1 → 2 → 1. For N = 3 we have six possible permutations, beginning with the identity map:

1 → 1, 2 → 2, 3 → 3 , and then 1 → 2 → 3 → 1, as well as 1 → 3 → 2 → 1 , 1 → 1, 2 ↔ 3 , 2 → 2, 1 ↔ 3 , and 3 → 3, 1 ↔ 2 .

We can see that permutations are most easily described by following the path of each element of the set when applying the permuation. Thus the permutation where 1 → 3, 2 → 1, 3 → 2, is most naturally described as the cycle “1 → 3 → 2 → 1”, which is usually written (1 3 2).5 In fact permutations break up into cycles. For example the permutation

1 2 3 4 5 6 7 8 9 10 is more transparently represented as ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ (1 7 4 9)(2 5 8)(3 10)(6). 7 5 10 9 8 6 4 2 1 3

This representation breaks the permutation down into (a product of) several cycles (each involving entirely different elements), and in a unique way (apart from the order in which the cycles are written, and the element with which each cycle begins). The only permu- tations that cannot be broken down further are cycles themselves (like (1 4 6 2 3 5)). To understand cycles in terms of coloured balls, Langer explains, on page 16, If you get Emmy’s colour, and I get your colour, and Emmy gets my colour then we have cycled those colours between us. The cycle contains the three of us, so it’s a 3-cycle.

The decomposition of a permutation into cycles cannot be broken down any further, so the cycles are indeed the fundamental constituent parts of permutations. Every permuta- tion is composed of them, but each permutation is composed of a different set of cycles. Therefore you can just as accurately identify a permutation through its set of cycles as through the permutation itself. It’s like the DNA of the permutation.

4In the script and in the paragraph above, a permutation was a re-arrangement of coloured balls. Now we seem to be referring to permutations of “N objects”. Is there a difference? One of the main reasons for pure mathematics is that often seemingly different mathematical problems are the same once one removes some confusing details. In this case all that matters is that we have N objects that we can distinguish and identify, whether they be coloured balls, volcanoes, hats or pole vaulters. The same mathematical theory of permutations, applies in the same way in each different case. Because of this it is usual to discuss permutations acting on “objects” or “letters”, or “elements” of a set of objects – something uninteresting so as not to distract from the universal applicability of the concept. 5This could also be written as (2 1 3) or (3 2 1); there is no difference in the meaning. 4 ANATOMY 101

We copied over this last paragraph, word-for-word, from the last paragraph about in- tegers, the only differences being to replace the word “integer” with “permutation”, and “prime” with “cycle”. This is where the analogies begin. Permutations, like integers, are a fundamental concept in mathematics, because they describe precisely how sets of objects change. As Langer says (on page 13):

When we try to understand the number of possible choices in a given situation, even taking into account certain restrictions, then the theory of permutations comes to the fore.

Apples and iPods We have just seen that primes are the fundamental components of an integer, and cycles are the fundamental components of a permutation, so can we find a sensible way to compare them? At first sight it seems unlikely. As Langer remarks on page 11,

Mr. Integer and Ms. Permutation are about as similar as apples and iPods.

What we have is a vague qualitative analogy. What we need is something richer, something that makes sense quantitatively as well. But how can we possibly compare permutations and integers, so as to compare their cycles and prime factors? We need some way to calibrate the two, and here we look to the training of the forensic scientist... When comparing the anatomies of two seemingly different organisms, the forensic scien- tist knows that one must calibrate their sizes else one might be misled into believing that they are different, whereas they might be twin organisms that have grown apart. In order to do such a calibration, one needs to find some essential feature of the organisms, that allows one to better compare the two objects. So how does one identify what are the key constituents of each organism? Forensic scientists consider the selection and measurement of this key constituent to be as much an art as a science. In order to properly calibrate integers and permutations, we must therefore get a better idea of how they typically look. We have already identified their fundamental components, the question is how to compare them. We begin with a fundamental questions: 1.1. What proportion of integers, and of permutations, are “fundamental”? The fundamental components of integers are primes, and of permutations are cycles, so our goal is to determine what proportion of the integers up to x are prime (an indecom- posable integer), and what proportion of permutations on a set of N objects are cycles (an indecomposable permutation). To do the first we need to determine the number of primes up to x, and divide by the total number of integers up to x. For the second we need to determine the number of cycles on a set of N objects, and divide by the total number of permutations on a set of N objects. It is easy to write down all of the integers up to x, namely 1, 2, 3, . . . , x, so there are x of them. Determining the number of permutations on a set of N elements is a little trickier. In fact there are surprisingly many different permutations on N objects, as Emmy explains ANDREW GRANVILLE 5

(for N = 12) in the script:6

The first person ... has a choice of N possible colours ... The second person ... has N − 1 possibilities ... The next person picks from N − 2 colours, the next from N − 3, etc ... The total number of permutations of N colours is N times N − 1 times N − 2, and so on, all the way down to times 1. We call this product N-factorial ... that is N! = N × (N − 1) × (N − 2) × ... × 2 × 1.

In the script we gave some idea of how big N! is, by noting that 12! is around 400 million, in fact 479, 001, 600 to be precise. For another example, 30! is about 2108, more than the number of computer operations that will be performed by all the computers in the world in the next century, which means that it is literally impossible to enumerate the 52! orderings of a regular pack of 52 playing cards in that time. The number of atoms in the observable universe is around 60! (about 1082), though not as large as the number of possible chess games, which is around 83! Factorials grow fast. To count the number of cycles on N objects, we must trace the path of an object, and make sure that the path never returns to itself until it has visited every other object: The first object can be mapped to any object but itself, so there are N − 1 possibilities. That second object in the “path”, can be mapped to any other object but itself and the first object, N − 2 possibilities. The third object can then be mapped to any of N − 3 possibilities, the fourth to N − 4, etc. Therefore, in total, the number of possibilities is

(N − 1) × (N − 2) × (N − 2) × ... × 2 × 1 = (N − 1)!.

In other words there are (N − 1)! cycles on a set of N objects. So what proportion of the permutations on N objects are cycles? From our last two results, we see that the proportion is (N − 1)! (N − 1) × (N − 2) × ... 2 × 1 1 = = , N! N × (N − 1) × ... 2 × 1 N by canceling the same numbers, 1, 2,..., (N − 1), from the top and the bottom of the fraction. In other words, one out of every N permutations on N objects is a cycle. Determining how many primes there are up to x is one of the oldest deep problems in mathematics. The ancient Greeks proved that there are infinitely many primes.7 The 26 year old Karl Frederich Gauss guessed from studying tables of primes that roughly one out of every log x of the integers around x is prime, though he never did develop a method to try to prove this. It needed the genius of Bernhard Riemann in 1859 to propose an extraordinary elaborate and indirect method to prove that this is true. It took until 1896 for mathematicians to prove enough of Riemann’s program to establish The Prime Number

6Here we paraphrase Emmy’s speech to give the argument for all N rather than just for N = 12. 7Which can be found in Euclid’s Elements. 6 ANATOMY 101

Theorem, that is that there are about8

x log x primes up to x. In other words roughly one out of every log x integers up to x is prime. Even today there is no easy proof of this deep fact. Is this enough information to find our sought-after calibration?

We know that roughly one out of every log x integers up to x is prime, and that exactly one in every N permutations on N letters is a cycle, so we could try to calibrate by replacing N when we measure the anatomy of a permutation with log x when we measure the anatomy of an integer — Gauss (page 17)

How can we check whether this proposed calibration makes sense? We could compare the number of fundamental constituent parts in a typical integer with the number of fundamental constituent parts in a typical permutation.

1.2. How many fundamental components does a typical integer or permutation break up into? In his lecture Gauss (page 18) states,

A typical permutation on N letters has about log N disjoint cycles. If our hypothesized ‘calibration’ is to make sense then we should be able to simply swap out the ‘N’ for a ‘log x’, and guess that a typical integer has about log log x distinct prime factors. Sounds unlikely, but it is true, ... [a] classic investigation [of] ... Hardy and Ramanujan [from 1917] .

This is encouraging, the proposed calibration works well in its first test, and we will look for other tests to further confirm our calibration. First, before proceeding, we should be more precise about several aspects of Gauss’s speech. First note that here, and throughout, “log” means the in base e (which is often written “ln” in schoolbooks). We explained what we mean by “about” in the footnote on the last page.9 Finally we need to clarify our use of the word “typical”. As one might expect, something is “typically true” of the set of permutations, if it is true for “most of them”; and by “most of them”, we mean “all but a small number of them”. To quantify this notion we consider the percentage of permutations on N letters which have about log N disjoint cycles. Remember that there are lots of permutations, N! of them, and let’s suppose that pN % of them have about

8Using the word “about” is not very precise, but we do mean something quite precise. In this case that x the ratio of the number of primes up to x, to log x , is a number that gets closer and closer to 1 as x gets larger. Indeed that the ratio is arbitrarily close to 1 for large enough x. We will use “about” several times in this discussion and, when we do, we always mean the same thing: A function f(x) is “about” g(x) if the ratio f(x)/g(x) gets closer and closer to 1 as x gets larger and larger, eventually becoming as close to 1 as one likes. 9So, for instance, by “about log N disjoint cycles”, Gauss meant, more precisely, that the ratio of the number of disjoint cycles to log N tends to 1 as N → ∞. ANDREW GRANVILLE 7

log N disjoint cycles. By “typically” we mean that pN % is arbitrarily close to 100% once N is large enough.10 More compelling justification for the proposed calibration to compare permutations and integers comes in asking more precise questions. For example, with what probability does one or the other organism have somewhat fewer parts, or somewhat more parts than log N (or log log x)? If you plot a graph of this data then although it initially seems chaotic, with enough data, you start to see a shape emerge:

Data that seems chaotic often organizes itself into certain recognizable patterns. The most common is where, when you graph the data, the plot is shaped like a bell around the average ... All the bells have the same basic shape, though the center may appear in different places, and some may be fatter than others. We measure the width of the bell by its ‘variance’. Langer (page 19)

In 1942, Goncharov showed that, as we vary over the permutations on N letters, the chances that the number of cycles is more than or less than a given quantity is governed by a Bell curve,11 with average log N and variance about log N. Similarly Erdos˝ and Kac showed in 1940 that, as we vary over the integers ≤ x, the probability that the number of distinct prime factors of an integer is more than or less than a given quantity is also governed by a Bell curve, this time with mean and variance around log log x. So again if we replace N by log x, our proposed calibration, then the two are exactly the same! A word of warning about the width of the bell: The actual width is really measured in terms of the standard deviation, which is the square root of the variance. Mathematicians and theoretical statisticians prefer the variance because it fits more neatly in all sorts of formulas. 1.3. How are the fundamental components of a typical permutation laid out?

... We have log N cycles in a typical N letter permutation, ... How do we study the lengths of those cycles? What is the right way to do it? — Gauss, page 22.

This is a tricky question; when one makes some obvious guesses the data does not seem to yield much. Somehow we must incorporate the information from the previous subsection, so Gauss goes on to ponder:

What is the simplest that has about log N elements up to N?

As Emmy notes, the simplest regular sequence of this type is surely

e1, e2, e3, . . . , e[log N].

10The precise mathematical formulation might read as follows: Fix arbitrarily small ² > 0. If N is sufficiently large (that is, larger than some function depending on ²) then the number of disjoint cycles in at least (1 − ²) · N! of the permutations on N letters is between (1 − ²) log N and (1 + ²) log N. Similarly if x is sufficiently large then then the number of prime factors in at least (1 − ²)x integers up to x is between (1 − ²) log log x and (1 + ²) log log x. 11Technically, this is called The Normal distribution. 8 ANATOMY 101

(Here [log N] denotes the largest integer that is no bigger than log N.) Could these really be the cycle lengths inside a “typical permutation”? The answer is obviously “no” for two reasons, first these are not integers, and a cycle length counts the number of objects in the cycle so must be an integer, and second,

that can’t be right ... the cycle lengths couldn’t always be that regular, could they? — Langer, page 22.

However this does suggest a way to proceed ... why don’t we take the logarithm of the length of each cycle [length] inside [a given] permutation and see how these numbers are distributed? [From the previous subsection we know that] there are about log N such numbers, each lying between 0 and log N, so ... [see] how they would be distributed. Will they all be clumped in one spot? ... Will they be well spread out? — Gauss, page 23.

Let us be a little more precise. Suppose that we are given a typical permutation σ of N objects, and that the cycles inside σ have lengths 1 ≤ c1 ≤ c2 ≤ ... ≤ ck ≤ N. Since σ is typical, we may suppose that k is around log N. Note that the length of a cycle is the same as the number of objects inside the cycle; and the cycles partition the N objects, so that c1 +c2 +...+ck = N. Our plan is to study the of these lengths, so writing `j = log cj for j = 1, 2, . . . , k, we have

0 ≤ `1 ≤ `2 ≤ · · · ≤ `k ≤ log N.

We have about log N numbers `j in the interval [0, log N]. This is an interval of length log N and so the average distance between these numbers is about 1.

Any permutation on N letters is made up of indecomposable cycles, of various different lengths. These add up to N, of course, so all these cycle lengths must be between 1 and N. A typical member of the permutation family has about log N cycles, so we needed to analyze the roughly log N numbers, given by the log of each cycle length, each of which is between 0 and log N. Notice that the average gap between these numbers is about 1. So how are the logs of the cycle lengths distributed? — Langer (page 30)

How are these numbers distributed within the interval? Will they be spread out evenly, or will they be bunched up in one part of the interval, and sparse in another part? Maybe they will be randomly distributed, whatever “random” means?

Being ‘randomly spread out’ doesn’t mean ... equally spaced out, it means that they are spaced according to a more complicated concept called a ‘Poisson point process’ ... like cars on a freeway — Emmy (page 26)

For another example consider hits on a website. If 3600 people open a certain webpage in an hour, one does not expect one hit every second, even though that is what it averages ANDREW GRANVILLE 9

out to be. What one expects is something more subtle, called a Poisson point process. There will be some seconds when there will be a lot of hits, and other longer periods when there are none. There is a precise formula to describe what one expects. To apply it in our example: The proportion of five second periods in the hour during which there are no hits −5 0 2 on the webpage in that given five second period is e 5 /0!, which is a little over 3 %, so should happen about 24 different times during the hour. On the other hand the proportion of seconds in the hour during which the webpage is hit five times in that same second, is −1 5 1 e 1 /5!, which is a little under 3 %, so should happen at about a dozen different times during the hour. The general formula for the proportion of ∆ second intervals in which there are exactly m hits is ∆m e−∆ . m! Other examples of a Poisson point process include the radioactive decay of atoms, the arrival of customers in a queue, cars on a freeway, ... all obey the same law. Indeed any situation where different objects appear randomly over time, more-or-less independently of one another. This is another example of the beauty of pure mathematics, where an abstract theory describes a common underlying theoretical structure in many seemingly different practical situations. However, in our case we are not considering anything random, since permutations and their cycle lengths are what they are, as are integers and their prime factors, neither are selected in some random fashion, so how can this rule possibly apply? Almost unreasonably one finds that these rules also govern the statistics of many pre-determined data, pretty much ubiquitously. How do we come up with such a formula when considering permutations? Remember the numbers `j, the logarithms of the lengths of the cycles in the permutation? We have k of them in an interval of length log N. Fix a real number ∆ > 0 and an integer m ≥ 0. For each permutation σ we count how often there are exactly m `js in an interval of length ∆. To be more precise, we consider intervals [x, x + ∆) with 0 ≤ x ≤ log N, and integrate 1 over those values of x for which there exists some j such that

`j < x ≤ `j+1 ≤ `j+2 ≤ ... ≤ `j+m < x + ∆ ≤ `j+m+1.

If we now divide by log N, we get the proportion of intervals of length ∆ containing exactly m `js. One can prove [3] that for a typical permutation this proportion is about

∆m e−∆ , m! for every ∆ > 0 and every m ≥ 0. Hence we can say that the distribution of the lengths of the cycles in typical permutations satisfy a Poisson point process. And what about for integers? We have already been replacing N by log x for comparison purposes of the sizes of the permutations and the integers. To compare the cycle lengths and prime factors we analogously replace the length of the jth smallestP cycle cj by the logarithm of the jth smallest prime factor log p . This makes sense since c = N, the P j j j length or size of the permutation, and j log pj = log n, the length of the integer when 10 ANATOMY 101

written out.12 Hence we now consider the distribution of the set of numbers {log log p : p|n}, which typically has about log log n elements, inside the interval [log log 2, log log n]. One can analogously prove [4] that the distribution of the set of prime factors of typical integers satisfy a Poisson point process. Permutations and integers therefore appear to be almost identical given our chosen calibration. However poisson and normal distributions appear in many situations in math- ematics, so perhaps these successful comparisons are not so surprising – after all the cycle lengths and prime factor sizes have to be distributed somehow, so one’s first guess would probably be that they should look like something random, and hence the poisson and normal distributions. .. The cycle lengths and the prime factor sizes have to be distributed somehow - so perhaps it was obvious that it would be something random ... to get something interesting, we need to look at unusual aspects of the anatomies of permutations and integers that are much less likely to be identical. — Emmy, page 29 Are there measures of permutations or integers that involve rather unusual functions, so that it would be more surprising if our two organisms calibrate so well? 1.4. The smallest parts. We can determine how often the smallest cycle length of a permutation is equal to a given integer. Even easier is to determine how often the smallest prime factor of an integer equal to 2, or 3, or 5 ... half the integers are even, so half of all integers have smallest prime factor 2. A third of the integers are divisible by 3, less half of these because they are even, and so one-sixth of all integers have smallest prime factor 3; etc. Although it is not difficult to answer these questions, we cannot directly compare the answers, because a cycle length cannot equal log p for a prime p, since a cycle length is always an integer and log p never is. Therefore the calibration used in the previous section does not make sense when considering the smallest prime factors and cycle lengths. If we allow slightly bigger primes p then the proportion of integers whose smallest prime factor is p is very small and therefore unwieldy. I can’t even figure out what it is I have to compare. Either the smallest com- ponent is too small to compare between the organisms. Or, if we only look at those in which the smallest component is a little larger and thus comparable, it occurs too rarely to observe — Emmy (page 37) Is it ok to ignore this information? Part of the art of ... Mathematics is to decide what evidence to ignore, if any. In this investigation we found that the smallest components cannot be sensibly compared, but only have a tiny influence on the key comparisons, so we will ignore these peripheral artifacts. — Langer (page 35)

12When we replace N by log x, we are comparing the length N of a permutation, to the logarithm of the length log n of an integer n (note that log n gives the number of digits in the integer n when written out). As a permutation decomposes into cycles, so the permutation length, N, decomposes into the sum of the cycle lengths cj . And as an integer n decomposes into its prime factors p, so its length, log n, decomposes into the sum of the lengths, log p, of its prime factors p, each p counted as often as it divides n. Hence we believe that the correct analogy to cj is log p. ANDREW GRANVILLE 11

If it is ok to ignore this information, then is there some other meaningful way in which we can compare the smallest component parts of integers and permutations?

Instead of specifying the smallest component, we could look at all of the integers, and permutations, that have no components smaller than a given size — Gauss (page 39)

At a stroke, we have not only got rid of the issue that the smallest component happens rarely, but we can also work in the range where we know our organisms are comparable — Emmy (page 37) and indeed this works well. For example, we could

count integers n, for which each prime factor has at least one tenth the number of digits of n. Then [count] ... permutations in which every cycle has length at least one tenth of the number of letters in the permutation. [It turns out that they are] ... in exactly the same proportion in each population. — Emmy (page 37)

And ... you get the same thing happening when you replace one tenth by any fraction you like — Gauss (page 39) There is a formula for this proportion, which is known as Buchstab’s function, that depends only on the fraction (one-tenth, or whatever replaces it). Buchstab’s function is not easily described since it only has a transcendental definition, that is it is defined as a certain average of its history. It starts off simply enough, ω(u) = 1/u for 1 ≤ u ≤ 2. But, for u > 2 the most palatable definition is ½ Z ¾ 1 u−1 ω(u) = 1 + ω(t) dt . u 1

Here we see how the value of the Buchstab function at u, depends on the behaviour of the function up to u − 1. No one has been able to find a simpler description of ω(u). To the untrained eye, ω(u) is difficult to identify because of this definition and the fact that

It decays to its limit really fast ... so there is hardly enough resolution on my screen to graph it beyond a certain point. — Emmy (page 37)

To be more precise, there exists a positive constant C > 0 such that ω(u) gets arbitrarily close to C as u grows, oscillating on either side of C, but never more than 1/u! away from C, a tiny difference. One can prove that the proportion of permutations on N letters in which every cycle has length at least N/u, is about uω(u)/N for large N. Following the reasoning of the 1 previous footnote, the analogy to comparing a cycle length cj with u N, is to compare 1 1/u log p to u log x for prime factors p of n ≤ x, that is p to x . In 1949 Buchstab showed that the proportion of integers ≤ x in which each prime factor is ≥ x1/u, is also about uω(u)/ log x for large x. This is the correct analogy for integers, replacing N by log x. But 12 ANATOMY 101

this result is more of a surprise than what we obtained before, since the Buchstab function is such a peculiar function.

Buchstab’s function? No one expects to see that. And both populations have this for their distribution function? No one can believe that it is a co-incidence, surely? — Gauss (page 44)

Moreover the same is true when comparing the smallest k cycles of a permutation with the smallest k prime factors of an integer. That is for any given u1 ≥ u2 ≥ · · · ≥ uk > 1, the proportion of permutations for which the k smallest cycles have lengths at least N/u1, N/u2, . . . , N/uk, respectively, is roughly the same as the proportion of integers for which the smallest k prime factors of an integer are at least x1/u1 , x1/u2 , . . . , x1/uk , respectively. 1.5. The largest parts. Just as one cannot directly compare the smallest parts of permutations and of integers, similarly one cannot directly compare the largest parts either, since no particular largest part occurs with high probability. However one can compare the probability that the largest parts are smaller than a give size. Specifically one can show that the proportion of permutations all of whose cycles are less than one-tenth the length of the permutation is roughly the same as the proportion of integers all of whose prime factors have less than one-tenth the number of digits of the integer itself. And a similar result with one-tenth replaced by any fraction. Again the proportion is a peculiar function with a transcendental definition, defined as a certain average of its history. This function, known as the Dickman-de Bruijn function, takes the value ρ(u) = 1 in the uninteresting range 0 < u ≤ 1, but then has the definition Z 1 u ρ(u) = ρ(t) dt for u > 1. u u−1

We see that the Dickman-de Bruijn function at u depends on the behaviour of the function up to u, and this is the simplest description known for ρ(u). As u gets large, ρ(u) gets very small, less than 1/u!, which is tiny, and indicates why we would not expect to find a simple description of ρ(u). Goncharov proved, in 1944, that the proportion of permutations on N letters in which every cycle has length at most N/u, is about ρ(u) for large N. If we replace N by log x, and cycle lengths by log p, then we might guess, in analogy, that the proportion of integers up to x in which every prime factor is ≤ x1/u is also about ρ(u) for large x. This was proved to be true by Dickman in 1930. The same analogy is true when comparing the largest k cycles of a permutation with the largest k prime factors of an integer. That is for any given 1 ≤ u1 ≤ u2 ≤ · · · ≤ uk the probability that a randomly chosen cycle on N letters has its jth largest cycle of length ≤ N/uj for j = 1, 2, . . . , k is more-or-less the same as the probability that a randomly chosen integer ≤ x has its jth largest prime factor ≤ x1/uj for j = 1, 2, . . . , k, for N and x both sufficiently large.13

13The probability theorists call this a Poisson-Dirichlet distribution if it holds true for all integers k. ANDREW GRANVILLE 13

That our two populations should display these features in common, both being described by these enormously complicated functions, is very surprising — Langer (page ) RSA14 is one of the key cryptographic algorithms that you encounter when shopping on the web and in all sorts of applications. To be able to break any implementation of RSA the hacker would need to be able to factor numbers quickly. To date, all factoring algorithms depend on auxiliary numbers which are “smooth”, that is numbers all of whose prime factors are suitably “small”. Hence to analyze those factoring algorithms, one needs to understand ρ(u) very well. Moreover approaches to other cryptographic algorithms also seem to depend on understanding smooth numbers, and hence the Dickman-de Bruijn function ... You see that function all the time in ad- vanced cryptography when you are trying to figure out how fast different algo- rithms run. — Gauss (page 56) See [2] for more discussion of such issues.

2. Even more analogies 2.1. The proportion with ` parts. What should we make of these similarities between the anatomies of integers and per- mutations? A skeptic might argue that we have mostly considered the “typical” integers and permutations, whereas it might be profitable to look at the atypical, for example those permutations with exactly ` cycles and those integers with exactly ` prime factors, even for atypical values of `. We created our calibration by comparing what proportion of integers are prime with what proportion of permutations are cycles. But what if we now com- pare the proportion of integers that have exactly two prime factors, with the proportion of permutations that have exactly two cycles — will they be the same? Or three? Or more? It turns out that in each case the formulas for these proportions are complicated, involving several different types of factors. But, when we replace N in the formulas for permutations, by log x we do obtain the formulas for integers. Quite a co-incidence! — Langer (page 36)

We know that one in every N permutations in SN is a cycle. We now ask what pro- portion of permutations in SN have exactly two cycles, or three or more? To count the number of permutations in SN that have exactly two cycles, let us suppose that object 1 lies in a cycle of length k, for some k in the range 1 ≤ k ≤ N − 1. Suppose object 1 is mapped to object a2, for which there are N − 1 possibilities, and then a2 is mapped to object a3, for which there are N − 2 possibilities, etcetera, on to ak−1, which is mapped to ak, for which there are N − k + 1 possibilities. But then ak is mapped back to object 1 (since the cycle is of length k), so the number of possibilities for the cycle containing 1 is (N − 1) × (N − 2) × ... × (N − k + 1).

14Named after its creators: Rivest, Shamir and Adleman. 14 ANATOMY 101

The remaining N − k elements must form one cycle (since we are counting permutations with exactly two cycles), and we proved earlier that there are (N − k − 1)! distinct cycles on N − k objects. Multiplying these together, we deduce that the number of permutations in SN with exactly two cycles, for which 1 is in a cycle of length k, is

(N − 1)! (N − 1) × (N − 2) × ... × (N − k + 1) × (N − k − 1)! = . N − k

Now we need to sum this quantity up over all the possible values of k, that is over k = 1, 2,...,N − 1, to obtain that the number of permutations in SN with exactly two cycles is NX−1 (N − 1)! NX−1 1 = (N − 1)! . N − k j k=1 j=1 Here we made the substitution k = N −j, so that j also runs over the integers 1, 2,...,N − 1. This sum seems a little unwieldy ... we will discuss it further in Advanced Anatomy, but for now, note that Z NX−1 1 N dt we can approximate the sum by the , which equals log N. j t j=1 t=1

Therefore the number of permutations in SN which have exactly two cycles is roughly (N − 1)! log N, and so the proportion of permutations in SN with exactly two cycles is about log N . N One can take this argument further, and establish that for any fixed integer ` ≥ 1, the proportion of permutations with exactly ` cycles is about

1 (log N)`−1 N (` − 1)!

(as was shown by Jordan in 1947). Notice that, once again, we have a Poisson type formula ∆m e−∆ . m! taking ∆ = log N, so that e−∆ = 1/N, and m = ` − 1. And what about integers up to x having exactly two prime factors, or three or more? Can we simply replace N by log x in the above results? It is an old theorem of Landau from 1909 that for any fixed integer ` ≥ 1, the proportion of integers up to x with exactly ` prime factors is around 1 (log log x)`−1 . log x (` − 1)! This is also a Poisson type formula taking ∆ = log log x and m = ` − 1. ANDREW GRANVILLE 15

Remember that a typical permutation has about log N cycles, and a typical integer up to x about log log x prime factors. The above formulas are for `, a fixed number of cycles and prime factors. We might wonder whether these formulas hold as ` grows with N and x, respectively. In fact as long as ` is significantly smaller than the expected number of cycles, log N, in the first case, and as long as ` is significantly smaller than the expected number of prime factors, log log x, in the second case, then indeed these Poisson type formulas continue to hold.15 As ` gets larger the formulas get more complicated, so we shall save our discussion for Advanced Anatomy. 2.2. The largest of the constituent parts. We have seen that the distribution of the size of the largest cycle of a randomly chosen permutation is determined by the transcen- dental Dickman-de Bruijn function, the same as for the distribution of the largest prime factor of a random integer. What if we restrict our attention to permutations with rather less or rather more cycles than is typical? Or integers with rather less or rather more prime factors than is typical? When the number of components is significantly smaller than typical, then one can show that the largest component is typically almost everything. More precisely if ` is significantly smaller than log N then, for almost all permutations on N letters with exactly ` cycles, the longest cycle has length close to N. Similarly if ` is significantly smaller than log log x then almost all integers n up to x, with exactly ` prime factors, have log p close to log n, for the largest prime factor p of n. The story is more interesting when there are rather more components than is typical:

How large is the largest component of an integer or a permutation if it has more components than is usual? Perhaps if there are more components than usual then there is more chance to have a particularly large one? Or perhaps, since their average size is smaller, the largest component is smaller than is typical? — Langer (page 36)

For almost all permutations on N letters with exactly ` cycles, where ` is significantly larger than log N,16 the longest cycle has length about

log τ ` N, where τ = . τ log N

This is a complicated formula, but the key things to notice are that this is a precise log τ estimate, and that τ gets smaller and smaller, eventually getting arbitrarily close to 0, as N gets larger, for all ` that are significantly larger than is typical. Hence

... the largest cycle of such a permutation is almost always smaller than for a typical permutation, and can be understood by another complicated function.— Langer (page 36)

15By “significantly smaller” we mean that although ` grows with N (or x), the ratio of ` to log N (or of ` to log log x) goes to 0 as N (or x) gets larger and larger. 16Here the ratio of ` to log N goes to ∞ as N gets larger and larger, though we will restrict ` so as not to be too large, for technical reasons. 16 ANATOMY 101

Now what happens if we study integers with exactly ` prime factors? For almost all in- tegers ≤ x with exactly ` cycles, where ` is significantly larger than log log x, the logarithm of the largest prime factor is about

log τ ` log x, where τ = . τ log log x

As you might expect by now, the analogous “complicated function” describes the analogous situation for integers.— Langer (page 36)

3. over finite fields. A f(t) of degree d is an expression of the form

d d−1 adt + ad−1t + ... + a1t + a0,

where the coefficients ad, ad−1, . . . , a1, a0 are given constants, with ad non-zero, where d is a non-negative integer, and t is a variable. Thus for example t2 + t + 41 is a polynomial, 3 1 1 4 2 1 as is x − 2 x + 3 , and even πy − ey + π y + 1. Often one substitutes in an integer for the variable, and then determines the value of the polynomial. A polynomial can be regarded as a mathematical object in its own right. One can add them, subtract them, multiply them, and sometimes divide one by another if the first is exactly divisible by the second. For example t3 + t2 + t + 1 times t − 1 equals t4 − 1. If we only consider polynomials with integer coefficients then they decompose much like integers and permutations: A polynomial of degree ≥ 1 is irreducible if it is not the product of two polynomials of smaller degree.17 Therefore t2 + 1 is irreducible, whereas t2 − 1 = (t − 1)(t + 1) is not. The reader might object that t2 + 1 = (t + i)(t − i) where i is a square root of −1, but i is an imaginary number and certainly not an integer, so the polynomials t − i and t + i do not have integer coefficients. Any polynomial can be factored into irreducibles because we can keep on factoring until we cannot go on. But is there only one such factorization, up to the order of the factors? To answer this question we need to go back to the question of factoring integers: The Fundamental Theorem of Arithmetic was stated only for positive integers, but what if we wish to factor −15? For there to be a unique factorization we need to write it as −1×3×5, but −1 is not a prime, so is this valid? At first one might think it best to nominate −1 to be a prime, so that the Theorem remains valid for the factorization of −15. However we then also have −15 = (−1)3 × 3 × 5 thus losing the principle of unique factorization! The only solution is to consider −1 to be a special factor,18 that we should divide out, if we can, before considering whether the factorization is unique. We will see that this blows up into a bigger issue when working with polynomials. Let’s factor −18t2 +8. This equals (−6t+4)(3t+2) as well as (6t−4)(−3t−2), and all of −6t+4, 3t+2, 6t−4 and −3t−2 are irreducible. Again the issue is the −1, so let’s remove that, so that −18t2 + 8 = −(18t2 − 8), and only consider polynomial factors of 18t2 − 8

17Just as a positive integer is prime if it is not the product of two smaller positive integers. 18−1 and 1 are called the units for the integers. ANDREW GRANVILLE 17

where the leading coefficient of each factor is positive. Now 18t2 − 8 equals (6t − 4)(3t + 2) as well as (6t + 4)(3t − 2), and all of 6t − 4, 3t + 2, 6t + 4 and 3t − 2 are irreducible. The problem now is the integer factor 2. One way to deal with that problem is to divide the greatest common divisor of the coefficients out from the polynomial. Now gcd(18, −8) = 2, so we divide 2 out from 18t2 − 8, to obtain 18t2 − 8 = 2(9t2 − 4); and then 9t2 − 4 factors in a unique way as 3t − 2 times 3t + 2. Therefore all integers are special factors when it comes to factoring polynomials with integer coefficients. With that, though, one can prove that every polynomial can be factored in a unique way as a special integer, times a product of irreducible polynomials (each of which has leading coefficient positive, and whose coefficients have greatest common divisor 1), up to the order. We wish to determine what proportion of polynomials with integer coefficients, of a given degree, are irreducible. However there are infinitely many polynomials with integer coefficients of a given degree, so the question does not exactly make sense as formulated. One gets around this by further restricting the coefficients of the polynomials. One way is to consider the polynomials where the coefficients are no bigger than x. Another idea is to consider polynomials mod p: The integers mod p are simply the remainders of those integers when one divides by p; this is one of the most basic notions in number theory, and is widely applicable because one can add, subtract, multiply and divide numbers mod p, as well as one can in the rational numbers.19 We will consider polynomials whose coefficients are to be taken mod p; we write 20 that the coefficients belong to Fp, the finite field on p elements. Because we can divide by any non-zero number in Fp, we can divide the leading coefficient out from any given polynomial, so that the polynomial can be written as a constant times a polynomial with leading coefficient 1 (which is called a monic polynomial). The Fundamental Theorem of Algebra implies that any monic polynomial with coefficients in Fp can be decomposed in a unique way as a product of irreducible monic polynomials in Fp. This is the decomposition that we will now study. How many monic polynomials in Fp have degree d? We can write down every polynomial d d−1 of degree d as t + ad−1t + ... + a1t + a0, where each ai can take any of the p possible d values in Fp, so the number of such polynomials is p . It is more difficult to determine how many are irreducible. Let us try for small d: Every degree 1 polynomial is irreducible, as one can only factor into components of degree ≥ 1, so all p monic polynomials in Fp of degree 1 are irreducible. If a polynomial of degree 2 is not irreducible then it must factor into two polynomials of degree 1. So to count the number of reducible monic polynomials in Fp of degree 2, we need simply count the number of different pairs of monic polynomials

19In the rational numbers you can divide any rational a by any non-zero rational b and get another non-zero rational number a/b. This is not true for the integers: for instance 2 does not divide into 3. However you do have this same property mod p. For instance if you wish to divide 3 by 2 mod 5, you simply find an integer whose remainder is 3 when divided by 5, and that is divisible by 2: one finds that 8 satisfies these properties so one can write 3/2 ≡ 8/2 ≡ 4 (mod 5). 20A field has the divisibility property discussed in the last footnote, as well as other more usual algebraic properties. There are finite fields, that is fields with only finitely many elements (note that there are infinitely many rational numbers, so the rationals are not a finite field), but they are rare. In fact there is just one such field (up to isomorphism) with q elements for each prime power q, denoted Fq, and no other finite fields. The integers mod p have the same structure as Fp for each prime p, but this is never true for higher powers of primes. 18 ANATOMY 101 ¡ ¢ of degree 1: There are p pairs which are two copies of the same polynomial, and p pairs ¡ ¢ ¡ ¢ 2 ¡ ¢ p+1 2 p+1 p−1 of distinct polynomials, making a grand total of 2 . Hence there are p − 2 = 2 ¡p−1¢ p2 p irreducible monic polynomials in Fp of degree 2. Note that 2 = 2 − 2 , which is close p2 to 2 when p is large; that is roughly one in every two monic polynomials of degree 2 is irreducible. We can generalize this technique to count exactly the number of monic irreducible polynomials in Fp of each degree, as we will discuss in Advanced Anatomy. The eventual result is that roughly one in every d monic polynomials of degree d in Fp is irreducible. This puts one clearly in mind of the result that one in every N permutations on N letters is a cycle and that one in every log x integers up to x is a prime, and suggests a calibration to compare the structure of the irreducible components of polynomials over finite fields with those of integers and of permutations. Can one prove comparable results about the structure of the irreducible components of polynomials over finite fields to those we have discussed above ... The jury is out on this question. There has not been so much research done, though we believe that many analogous results will emerge under a suitable investigation (for the latest, see the recent article by Kowalski, E. and Nikeghbali A.)

4. Whys, other relations, and uses. 4.1. Why?

[We] ... still want to understand why - why are their anatomies so similar? Do they have the same DNA? Is one modeled on the other? You don’t seem to be talking about genetics so how can the math tell you all this with no biological explanation — von Neumann (page 55)

... We have ... two possible explanations. One from probability theory, the other from analytic combinatorics - turn to your hand-outs, section 5.1. Ad- mittedly neither is incredibly persuasive, but that is as much as we know for now. — Gauss (page 55)

We will discuss these two viewpoints in Advanced Anatomy.

... we now suspect that many other populations have remarkably similar anatomies ... Permutations and Integers, ... [and] Polynomials in finite fields — Gauss (page 55)

Other populations which appear to be candidates to share similar anatomies include: • The connected components of the 2-regular graphs on N labeled vertices; that is, the vertices should all appear in a set of non-trivial disjoint cycles. • The connected components of the directed graphs given by the edges (i, f(i)) of any 1 map f : {1, 2,...,N} → {1, 2,...,N} (which typically have about 2 log N components). • The equivalence classes of mappings {1, 2,...,N} → {1, 2,...,N}, where π1, π2 are equivalent if there exist permutations σ, τ such that π2 = σπ1τ. ANDREW GRANVILLE 19

• Additive arithmetic semigroups, and other algebraic objects generalizing the rational integers, or polynomials over finite fields. 4.2. Other situations? In 1994 Vershik provided perhaps the best explanation for this phenomenon: Fundamental mathematical structures should be organized in a natural way. There are a few outstanding possibilities for this “natural anatomy” (seven are listed in [9]), including the structure we see here. What is perhaps new in this article is the amazing amount of detail that these different anatomies share. The idea that wildly different objects should be organized along very similar lines has emerged recently in an area on the boundary between quantum chaos in mathematical physics and the theory of zeta functions in analytic number theory: Sets of eigenvalues of various naturally arising operators (for example, in quantum chaos), and zeros of L-functions also seem to always be organized in very similar ways, according to the distribution of the eigenvalues of matrices randomly selected from certain groups: In 1999, Katz and Sarnak suggested, with a lot of theoretical and computational evidence, that only a small set of possible groups seem to ever arise. I don’t think anyone can say why, indeed it all seems unreasonably convenient, begging for a unifying explanation.

Credits 1. Feller, W. (1968), An Introduction to Probability Theory and Its Application (3rd ed), vol. 1, Wiley, New York. 2. Granville, A., It is easy to determine whether a given integer is prime,, Bull. Amer. Math. Soc. 42 (2005), 3-38. 3. , Cycle lengths in a permutation are typically Poisson distributed, Electr. J. Combinatorics 13 / R107 (2006), 23. 4. , Prime divisors are Poisson distributed, Int. J. Number theory 3 (2007), 1-18. 5. Granville, A. and Granville, J. (2010), Mathematical Sciences Investigation (MSI): The Anatomy of Integers and Permutations (to appear). 6. Katz, N.M. and Sarnak, P. (1999), Zeroes of zeta functions and symmetry, Bull. Amer. Math. Soc 36, 1–26.. 7. Knuth, D.E. and Trabb Prado, L. (1976), Analysis of a simple factorization algorithm, Theoret. Comput. Sci 3, 321-348. 8. Kowalski, E. and Nikeghbali A., Mod-Poisson convergence in probability and number theory (to appear). 9. Vershik, A.M. (1995), Asymptotic combinatorics and algebraic analysis, Proc ICM Zurich (1994), 1384–1394.

D´epartment de Math´ematiqueset Statistique, Universit´ede Montr´eal,CP 6128 succ Centre-Ville, Montr´eal,Qu´ebec H3C 3J7, Canada. [email protected] http://www.dms.umontreal.ca/∼andrew/