They're millions of digits long, and it takes an army of mathematicians and machines to hunt them down — what's not to love about monster primes? Adam Spencer, comedian and lifelong math geek, shares his passion for these odd numbers, and for the mysterious magic of math.
Ah yes, those university days, a heady mix of Ph.D-level pure mathematics and world debating championships, or, as I like to say, "Hello, ladies. Oh yeah." Didn't get much sexier than the Spence at university, let me tell you.
It is such a thrill for a humble breakfast radio announcer from Sydney, Australia, to be here on the TED stage literally on the other side of the world. And I wanted to let you know, a lot of the things you've heard about Australians are true. From the youngest of ages, we display a prodigious sporting talent. On the field of battle, we are brave and noble warriors. What you've heard is true. Australians, we don't mind a bit of a drink, sometimes to excess, leading to embarrassing social situations. (Laughter) This is my father's work Christmas party, December 1973. I'm almost five years old. Fair to say, I'm enjoying the day a lot more than Santa was.
But I stand before you today not as a breakfast radio host, not as a comedian, but as someone who was, is, and always will be a mathematician. And anyone who's been bitten by the numbers bug knows that it bites early and it bites deep.
I cast my mind back when I was in second grade at a beautiful little government-run school called Boronia Park in the suburbs of Sydney, and as we came up towards lunchtime, our teacher, Ms. Russell, said to the class, "Hey, year two. What do you want to do after lunch? I've got no plans." It was an exercise in democratic schooling, and I am all for democratic schooling, but we were only seven. So some of the suggestions we made as to what we might want to do after lunch were a little bit impractical, and after a while, someone made a particularly silly suggestion and Ms. Russell patted them down with that gentle aphorism, "That wouldn't work. That'd be like trying to put a square peg through a round hole."
Now I wasn't trying to be smart. I wasn't trying to be funny. I just politely raised my hand, and when Ms. Russell acknowledged me, I said, in front of my year two classmates, and I quote, "But Miss, surely if the diagonal of the square is less than the diameter of the circle, well, the square peg will pass quite easily through the round hole." (Laughter) "It'd be like putting a piece of toast through a basketball hoop, wouldn't it?"
And there was that same awkward silence from most of my classmates, until sitting next to me, one of my friends, one of the cool kids in class, Steven, leaned across and punched me really hard in the head. (Laughter) Now what Steven was saying was, "Look, Adam, you are at a critical juncture in your life here, my friend. You can keep sitting here with us. Any more of that sort of talk, you've got to go and sit over there with them."
I thought about it for a nanosecond. I took one look at the road map of life, and I ran off down the street marked "Geek" as fast as my chubby, asthmatic little legs would carry me.
I fell in love with mathematics from the earliest of ages. I explained it to all my friends. Maths is beautiful. It's natural. It's everywhere. Numbers are the musical notes with which the symphony of the universe is written. The great Descartes said something quite similar. The universe "is written in the mathematical language." And today, I want to show you one of those musical notes, a number so beautiful, so massive, I think it will blow your mind.
Today we're going to talk about prime numbers. Most of you I'm sure remember that six is not prime because it's 2 x 3. Seven is prime because it's 1 x 7, but we can't break it down into any smaller chunks, or as we call them, factors. Now a few things you might like to know about prime numbers. One is not prime. The proof of that is a great party trick that admittedly only works at certain parties.
(Laughter)
Another thing about primes, there is no final biggest prime number. They keep going on forever. We know there are an infinite number of primes due to the brilliant mathematician Euclid. Over thousands of years ago, he proved that for us. But the third thing about prime numbers, mathematicians have always wondered, well at any given moment in time, what is the biggest prime that we know about?
Today we're going to hunt for that massive prime. Don't freak out. All you need to know, of all the mathematics you've ever learned, unlearned, crammed, forgotten, never understood in the first place, all you need to know is this: When I say 2 ^ 5, I'm talking about five little number twos next to each other all multiplied together, 2 x 2 x 2 x 2 x 2. So 2 ^ 5 is 2 x 2 = 4, 8, 16, 32. If you've got that, you're with me for the entire journey. Okay? So 2 ^ 5, those five little twos multiplied together. (2 ^ 5) - 1 = 31. 31 is a prime number, and that five in the power is also a prime number. And the vast bulk of massive primes we've ever found are of that form: two to a prime number, take away one. I won't go into great detail as to why, because most of your eyes will bleed out of your head if I do, but suffice to say, a number of that form is fairly easy to test for primacy. A random odd number is a lot harder to test. But as soon as we go hunting for massive primes, we realize it's not enough just to put in any prime number in the power. (2 ^ 11) - 1 = 2,047, and you don't need me to tell you that's 23 x 89. (Laughter) But (2 ^ 13) - 1, (2 ^ 17) - 1 (2 ^ 19) - 1, are all prime numbers. After that point, they thin out a lot.
And one of the things about the search for massive primes that I love so much is some of the great mathematical minds of all time have gone on this search. This is the great Swiss mathematician Leonhard Euler. In the 1700s, other mathematicians said he is simply the master of us all. He was so respected, they put him on European currency back when that was a compliment.
(Laughter)
Euler discovered at the time the world's biggest prime: (2 ^ 31) - 1. It's over two billion. He proved it was prime with nothing more than a quill, ink, paper and his mind.
You think that's big. We know that (2 ^ 127) - 1 is a prime number. It's an absolute brute. Look at it here: 39 digits long, proven to be prime in 1876 by a mathematician called Lucas. Word up, L-Dog.
(Laughter)
But one of the great things about the search for massive primes, it's not just finding the primes. Sometimes proving another number not to be prime is just as exciting. Lucas again, in 1876, showed us (2 ^ 67) - 1, 21 digits long, was not prime. But he didn't know what the factors were. We knew it was like six, but we didn't know what are the 2 x 3 that multiply together to give us that massive number.
We didn't know for almost 40 years until Frank Nelson Cole came along. And at a gathering of prestigious American mathematicians, he walked to the board, took up a piece of chalk, and started writing out the powers of two: two, four, eight, 16 -- come on, join in with me, you know how it goes -- 32, 64, 128, 256, 512, 1,024, 2,048. I'm in geek heaven. We'll stop it there for a second. Frank Nelson Cole did not stop there. He went on and on and calculated 67 powers of two. He took away one and wrote that number on the board. A frisson of excitement went around the room. It got even more exciting when he then wrote down these two large prime numbers in your standard multiplication format -- and for the rest of the hour of his talk Frank Nelson Cole busted that out. He had found the prime factors of (2 ^ 67) - 1. The room went berserk -- (Laughter) -- as Frank Nelson Cole sat down, having delivered the only talk in the history of mathematics with no words. He admitted afterwards it wasn't that hard to do. It took focus. It took dedication. It took him, by his estimate, "three years of Sundays."
But then in the field of mathematics, as in so many of the fields that we've heard from in this TED, the age of the computer goes along and things explode. These are the largest prime numbers we knew decade by decade, each one dwarfing the one before as computers took over and our power to calculate just grew and grew.
This is the largest prime number we knew in 1996, a very emotional year for me. It was the year I left university. I was torn between mathematics and media. It was a tough decision. I loved university. My arts degree was the best nine and a half years of my life.
(Laughter)
But I came to a realization about my own ability. Put simply, in a room full of randomly selected people, I'm a maths genius. In a roomful of maths Ph.Ds, I'm as dumb as a box of hammers. My skill is not in the mathematics. It is in telling the story of the mathematics.
And during that time, since I've left university, these numbers have got bigger and bigger, each one dwarfing the last, until along came this man, Dr. Curtis Cooper, who a few years ago held the record for the largest ever prime, only to see it snatched away by a rival university. And then Curtis Cooper got it back. Not years ago, not months ago, days ago. In an amazing moment of serendipity, I had to send TED a new slide to show you what this guy had done.
I still remember -- (Applause) -- I still remember when it happened. I was doing my breakfast radio show. I looked down on Twitter. There was a tweet: "Adam, have you seen the new largest prime number?" I shivered -- (Laughter) -- contacted the women who produced my radio show out in the other room, and said "Girls, hold the front page. We're not talking politics today. We're not talking sport today. They found another megaprime." The girls just shook their heads, put them in their hands, and let me go my own way.
It's because of Curtis Cooper that we know, currently the largest prime number we know, is 2 ^ 57,885,161. Don't forget to subtract the one. This number is almost 17 and a half million digits long. If you typed it out on a computer and saved it as a text file, that's 22 meg. For the slightly less geeky of you, think about the Harry Potter novels, okay? This is the first Harry Potter novel. This is all seven Harry Potter novels, because she did tend to faff on a bit near the end. (Laughter) Written out as a book, this number would run the length of the Harry Potter novels and half again. Here's a slide of the first 1,000 digits of this prime. If, when TED had begun, at 11 o'clock on Tuesday, we'd walked out and simply hit one slide every second, it would have taken five hours to show you that number. I was keen to do it, could not convince Bono. That's the way it goes.
This number is 17 and a half thousand slides long, and we know it is prime as confidently as we know the number seven is prime. That fills me with almost sexual excitement. And who am I kidding when I say almost?
(Laughter)
I know what you're thinking: Adam, we're happy that you're happy, but why should we care? Let me give you just three reasons why this is so beautiful.
First of all, as I explained, to ask a computer "Is that number prime?" to type it in its abbreviated form, and then only about six lines of code is the test for primacy, is a remarkably simple question to ask. It's got a remarkably clear yes/no answer, and just requires phenomenal grunt. Large prime numbers are a great way of testing the speed and accuracy of computer chips.
But secondly, as Curtis Cooper was looking for that monster prime, he wasn't the only guy searching. My laptop at home was looking through four potential candidate primes myself as part of a networked computer hunt around the world for these large numbers. The discovery of that prime is similar to the work people are doing in unraveling RNA sequences, in searching through data from SETI and other astronomical projects. We live in an age where some of the great breakthroughs are not going to happen in the labs or the halls of academia but on laptops, desktops, in the palms of people's hands who are simply helping out for the search.
But for me it's amazing because it's a metaphor for the time in which we live, when human minds and machines can conquer together. We've heard a lot about robots in this TED. We've heard a lot about what they can and can't do. It is true, you can now download onto your smartphone an app that would beat most grandmasters at chess.
You think that's cool. Here's a machine doing something cool. This is the CubeStormer II. It can take a randomly shuffled Rubik's Cube. Using the power of the smartphone, it can examine the cube and solve the cube in five seconds.
(Applause)
That scares some people. That excites me. How lucky are we to live in this age when mind and machine can work together?
I was asked in an interview last year in my capacity as a lower-case "c" celebrity in Australia, "What was your highlight of 2012?" People were expecting me to talk about my beloved Sydney Swans football team. In our beautiful, indigenous sport of Australian football, they won the equivalent of the Super Bowl. I was there. It was the most emotional, exciting day. It wasn't my highlight of 2012. People thought it might have been an interview I'd done on my show. It might have been a politician. It might have been a breakthrough. It might have been a book I read, the arts. No, no, no. It might have been something my two gorgeous daughters had done. No, it wasn't. The highlight of 2012, so clearly, was the discovery of the Higgs boson. Give it up for the fundamental particle that bequeaths all other fundamental particles their mass.
(Applause)
And what was so gorgeous about this discovery was 50 years ago Peter Higgs and his team considered one of the deepest of all questions: How is it that the things that make us up have no mass? I've clearly got mass. Where does it come from? And he postulated a suggestion that there's this infinite, incredibly small field stretching throughout the universe, and as other particles go through those particles and interact, that's where they get their mass. The rest of the scientific community said, "Great idea, Higgsy. We've got no idea if we could ever prove it. It's beyond our reach." And within just 50 years, in his lifetime, with him sitting in the audience, we had designed the greatest machine ever to prove this incredible idea that originated just in a human mind.
That's what is so exciting for me about this prime number. We thought it might be there, and we went and found it. That is the essence of being human. That is what we are all about. Or as my friend Descartes might put it, we think, therefore we are.
Thank you.
(Applause)
Ah yes, those university days, a heady mix of Ph.D-level pure mathematics and world debating championships, or, as I like to say, "Hello, ladies. Oh yeah." Didn't get much sexier than the Spence at university, let me tell you.
It is such a thrill for a humble breakfast radio announcer from Sydney, Australia, to be here on the TED stage literally on the other side of the world. And I wanted to let you know, a lot of the things you've heard about Australians are true. From the youngest of ages, we display a prodigious sporting talent. On the field of battle, we are brave and noble warriors. What you've heard is true. Australians, we don't mind a bit of a drink, sometimes to excess, leading to embarrassing social situations. (Laughter) This is my father's work Christmas party, December 1973. I'm almost five years old. Fair to say, I'm enjoying the day a lot more than Santa was.
But I stand before you today not as a breakfast radio host, not as a comedian, but as someone who was, is, and always will be a mathematician. And anyone who's been bitten by the numbers bug knows that it bites early and it bites deep.
I cast my mind back when I was in second grade at a beautiful little government-run school called Boronia Park in the suburbs of Sydney, and as we came up towards lunchtime, our teacher, Ms. Russell, said to the class, "Hey, year two. What do you want to do after lunch? I've got no plans." It was an exercise in democratic schooling, and I am all for democratic schooling, but we were only seven. So some of the suggestions we made as to what we might want to do after lunch were a little bit impractical, and after a while, someone made a particularly silly suggestion and Ms. Russell patted them down with that gentle aphorism, "That wouldn't work. That'd be like trying to put a square peg through a round hole."
Now I wasn't trying to be smart. I wasn't trying to be funny. I just politely raised my hand, and when Ms. Russell acknowledged me, I said, in front of my year two classmates, and I quote, "But Miss, surely if the diagonal of the square is less than the diameter of the circle, well, the square peg will pass quite easily through the round hole." (Laughter) "It'd be like putting a piece of toast through a basketball hoop, wouldn't it?"
And there was that same awkward silence from most of my classmates, until sitting next to me, one of my friends, one of the cool kids in class, Steven, leaned across and punched me really hard in the head. (Laughter) Now what Steven was saying was, "Look, Adam, you are at a critical juncture in your life here, my friend. You can keep sitting here with us. Any more of that sort of talk, you've got to go and sit over there with them."
I thought about it for a nanosecond. I took one look at the road map of life, and I ran off down the street marked "Geek" as fast as my chubby, asthmatic little legs would carry me.
I fell in love with mathematics from the earliest of ages. I explained it to all my friends. Maths is beautiful. It's natural. It's everywhere. Numbers are the musical notes with which the symphony of the universe is written. The great Descartes said something quite similar. The universe "is written in the mathematical language." And today, I want to show you one of those musical notes, a number so beautiful, so massive, I think it will blow your mind.
Today we're going to talk about prime numbers. Most of you I'm sure remember that six is not prime because it's 2 x 3. Seven is prime because it's 1 x 7, but we can't break it down into any smaller chunks, or as we call them, factors. Now a few things you might like to know about prime numbers. One is not prime. The proof of that is a great party trick that admittedly only works at certain parties.
(Laughter)
Another thing about primes, there is no final biggest prime number. They keep going on forever. We know there are an infinite number of primes due to the brilliant mathematician Euclid. Over thousands of years ago, he proved that for us. But the third thing about prime numbers, mathematicians have always wondered, well at any given moment in time, what is the biggest prime that we know about?
Today we're going to hunt for that massive prime. Don't freak out. All you need to know, of all the mathematics you've ever learned, unlearned, crammed, forgotten, never understood in the first place, all you need to know is this: When I say 2 ^ 5, I'm talking about five little number twos next to each other all multiplied together, 2 x 2 x 2 x 2 x 2. So 2 ^ 5 is 2 x 2 = 4, 8, 16, 32. If you've got that, you're with me for the entire journey. Okay? So 2 ^ 5, those five little twos multiplied together. (2 ^ 5) - 1 = 31. 31 is a prime number, and that five in the power is also a prime number. And the vast bulk of massive primes we've ever found are of that form: two to a prime number, take away one. I won't go into great detail as to why, because most of your eyes will bleed out of your head if I do, but suffice to say, a number of that form is fairly easy to test for primacy. A random odd number is a lot harder to test. But as soon as we go hunting for massive primes, we realize it's not enough just to put in any prime number in the power. (2 ^ 11) - 1 = 2,047, and you don't need me to tell you that's 23 x 89. (Laughter) But (2 ^ 13) - 1, (2 ^ 17) - 1 (2 ^ 19) - 1, are all prime numbers. After that point, they thin out a lot.
And one of the things about the search for massive primes that I love so much is some of the great mathematical minds of all time have gone on this search. This is the great Swiss mathematician Leonhard Euler. In the 1700s, other mathematicians said he is simply the master of us all. He was so respected, they put him on European currency back when that was a compliment.
(Laughter)
Euler discovered at the time the world's biggest prime: (2 ^ 31) - 1. It's over two billion. He proved it was prime with nothing more than a quill, ink, paper and his mind.
You think that's big. We know that (2 ^ 127) - 1 is a prime number. It's an absolute brute. Look at it here: 39 digits long, proven to be prime in 1876 by a mathematician called Lucas. Word up, L-Dog.
(Laughter)
But one of the great things about the search for massive primes, it's not just finding the primes. Sometimes proving another number not to be prime is just as exciting. Lucas again, in 1876, showed us (2 ^ 67) - 1, 21 digits long, was not prime. But he didn't know what the factors were. We knew it was like six, but we didn't know what are the 2 x 3 that multiply together to give us that massive number.
We didn't know for almost 40 years until Frank Nelson Cole came along. And at a gathering of prestigious American mathematicians, he walked to the board, took up a piece of chalk, and started writing out the powers of two: two, four, eight, 16 -- come on, join in with me, you know how it goes -- 32, 64, 128, 256, 512, 1,024, 2,048. I'm in geek heaven. We'll stop it there for a second. Frank Nelson Cole did not stop there. He went on and on and calculated 67 powers of two. He took away one and wrote that number on the board. A frisson of excitement went around the room. It got even more exciting when he then wrote down these two large prime numbers in your standard multiplication format -- and for the rest of the hour of his talk Frank Nelson Cole busted that out. He had found the prime factors of (2 ^ 67) - 1. The room went berserk -- (Laughter) -- as Frank Nelson Cole sat down, having delivered the only talk in the history of mathematics with no words. He admitted afterwards it wasn't that hard to do. It took focus. It took dedication. It took him, by his estimate, "three years of Sundays."
But then in the field of mathematics, as in so many of the fields that we've heard from in this TED, the age of the computer goes along and things explode. These are the largest prime numbers we knew decade by decade, each one dwarfing the one before as computers took over and our power to calculate just grew and grew.
This is the largest prime number we knew in 1996, a very emotional year for me. It was the year I left university. I was torn between mathematics and media. It was a tough decision. I loved university. My arts degree was the best nine and a half years of my life.
(Laughter)
But I came to a realization about my own ability. Put simply, in a room full of randomly selected people, I'm a maths genius. In a roomful of maths Ph.Ds, I'm as dumb as a box of hammers. My skill is not in the mathematics. It is in telling the story of the mathematics.
And during that time, since I've left university, these numbers have got bigger and bigger, each one dwarfing the last, until along came this man, Dr. Curtis Cooper, who a few years ago held the record for the largest ever prime, only to see it snatched away by a rival university. And then Curtis Cooper got it back. Not years ago, not months ago, days ago. In an amazing moment of serendipity, I had to send TED a new slide to show you what this guy had done.
I still remember -- (Applause) -- I still remember when it happened. I was doing my breakfast radio show. I looked down on Twitter. There was a tweet: "Adam, have you seen the new largest prime number?" I shivered -- (Laughter) -- contacted the women who produced my radio show out in the other room, and said "Girls, hold the front page. We're not talking politics today. We're not talking sport today. They found another megaprime." The girls just shook their heads, put them in their hands, and let me go my own way.
It's because of Curtis Cooper that we know, currently the largest prime number we know, is 2 ^ 57,885,161. Don't forget to subtract the one. This number is almost 17 and a half million digits long. If you typed it out on a computer and saved it as a text file, that's 22 meg. For the slightly less geeky of you, think about the Harry Potter novels, okay? This is the first Harry Potter novel. This is all seven Harry Potter novels, because she did tend to faff on a bit near the end. (Laughter) Written out as a book, this number would run the length of the Harry Potter novels and half again. Here's a slide of the first 1,000 digits of this prime. If, when TED had begun, at 11 o'clock on Tuesday, we'd walked out and simply hit one slide every second, it would have taken five hours to show you that number. I was keen to do it, could not convince Bono. That's the way it goes.
This number is 17 and a half thousand slides long, and we know it is prime as confidently as we know the number seven is prime. That fills me with almost sexual excitement. And who am I kidding when I say almost?
(Laughter)
I know what you're thinking: Adam, we're happy that you're happy, but why should we care? Let me give you just three reasons why this is so beautiful.
First of all, as I explained, to ask a computer "Is that number prime?" to type it in its abbreviated form, and then only about six lines of code is the test for primacy, is a remarkably simple question to ask. It's got a remarkably clear yes/no answer, and just requires phenomenal grunt. Large prime numbers are a great way of testing the speed and accuracy of computer chips.
But secondly, as Curtis Cooper was looking for that monster prime, he wasn't the only guy searching. My laptop at home was looking through four potential candidate primes myself as part of a networked computer hunt around the world for these large numbers. The discovery of that prime is similar to the work people are doing in unraveling RNA sequences, in searching through data from SETI and other astronomical projects. We live in an age where some of the great breakthroughs are not going to happen in the labs or the halls of academia but on laptops, desktops, in the palms of people's hands who are simply helping out for the search.
But for me it's amazing because it's a metaphor for the time in which we live, when human minds and machines can conquer together. We've heard a lot about robots in this TED. We've heard a lot about what they can and can't do. It is true, you can now download onto your smartphone an app that would beat most grandmasters at chess.
You think that's cool. Here's a machine doing something cool. This is the CubeStormer II. It can take a randomly shuffled Rubik's Cube. Using the power of the smartphone, it can examine the cube and solve the cube in five seconds.
(Applause)
That scares some people. That excites me. How lucky are we to live in this age when mind and machine can work together?
I was asked in an interview last year in my capacity as a lower-case "c" celebrity in Australia, "What was your highlight of 2012?" People were expecting me to talk about my beloved Sydney Swans football team. In our beautiful, indigenous sport of Australian football, they won the equivalent of the Super Bowl. I was there. It was the most emotional, exciting day. It wasn't my highlight of 2012. People thought it might have been an interview I'd done on my show. It might have been a politician. It might have been a breakthrough. It might have been a book I read, the arts. No, no, no. It might have been something my two gorgeous daughters had done. No, it wasn't. The highlight of 2012, so clearly, was the discovery of the Higgs boson. Give it up for the fundamental particle that bequeaths all other fundamental particles their mass.
(Applause)
And what was so gorgeous about this discovery was 50 years ago Peter Higgs and his team considered one of the deepest of all questions: How is it that the things that make us up have no mass? I've clearly got mass. Where does it come from? And he postulated a suggestion that there's this infinite, incredibly small field stretching throughout the universe, and as other particles go through those particles and interact, that's where they get their mass. The rest of the scientific community said, "Great idea, Higgsy. We've got no idea if we could ever prove it. It's beyond our reach." And within just 50 years, in his lifetime, with him sitting in the audience, we had designed the greatest machine ever to prove this incredible idea that originated just in a human mind.
That's what is so exciting for me about this prime number. We thought it might be there, and we went and found it. That is the essence of being human. That is what we are all about. Or as my friend Descartes might put it, we think, therefore we are.
Thank you.
(Applause)