I'm gonna answer the question, "How many grayscale images are there?"
I was first asked this question exactly a week ago from now,
and by now I mean the now as in when the video first goes live.
Not the now as in when I'm recording this or the now as in when you're watching this.
Unless of course you've subscribed to my standupmaths channel
and you're one of those many people who watches the videos the second they get the notification
in which case yes, you are in the correct now.
I was asked the question because, as I have mentioned before
I am approximately one-third of a science-comedy group called "Festival of the Spoken Nerd"
(link to DVD in description)
and we recently got a radio series!
We've got a series of 15-minute episodes which are on BBC Radio 4 at 11:15 pm.
That's just how much faith BBC Comedy have in us.
But to promote the first one of those, which was on last Wednesday,
we were asked to do a kind of ask me anything science themed thing on Twitter.
The show is called Domestic Science,
the idea is we talk about science in and around your home and things you can try at home.
As part of that we answer semi-serious domestic questions
with ridiculous mathematical and scientific answers.
And the BBC thought it would be a good idea if we did that on Twitter
in the lead up to the episode being broadcast.
And as a massive fan of convoluted and non-spontaneous social media interactions, I was in.
So here's the question that caught my eye.
So a David Morrison asked:
"How long would it take a supercomputer to generate all possible gray scale images at 256 by 256 pixels?"
Given this is David's idea of a domestic problem question,
I've got a lot of follow on questions about his home life.
Maybe, I don't know what he does for a living,
maybe he's over-committed to delivering said images to a client.
Or maybe he's just curious.
Either way, I thought this was very interesting.
I thought, "You know what, I'm gonna answer this."
Sadly, answering David's question came at the cost of me doing pretty much anything else.
I got pretty obsessed by it and didn't answer any other questions.
Genuinely, it was quite interesting!
Although, technically, I did still spend the entire time engaged with our
online community demographic, whatever.
And, uh, the reason I'm making this video now is two-fold.
Partly it's so interesting there's some more things I would like to talk about
when it comes to the number of gray scale images.
Secondly, our second episode is going live tonight, it's Wednesday the 27th of July 2016.
And I can't join in the online Domestic Science Q&A this time, because I'm currently in an aircraft.
And that's the currently as in when the video goes live,
I've prerecorded this and I scheduled it to go up when the Q&A is on.
So this is my part of interacting with all you social media kids.
If you are watching this because you got the notification the moment it went live,
you can pause it and you can join in on Twitter with Helen Arney and Steve Mould.
Or you can just watch the video and then at quarter past eleven
you can listen to Domestic Science on BBC Radio 4.
For people not in the United Kingdom, you don't miss out,
the BBC will put it on their radio player for a week, which you can listen to anywhere in the world.
I'll put a link below.
And the first episode went so well that they released it as a podcast!
That's an MP3 that you can have and hold for the rest of your natural life.
So I'll put a link to that below.
Anywhere in the world you can enjoy some Domestic Science.
Right, on to the question.
So what is a 256 by 256 image?
Well this video I'm currently in, I'm recording it in approximately 1922 pixels across
and 1080 pixels up and down.
And so if you just took a 256 square pixel section, it's pretty much that.
So if we want a grayscale image that size
hang on, hang on, hang on, ready, ready?
There we go!
So that is a 256 by 256 grayscale image.
It's not very big, but that's what David asked about.
So there is my one pseudo, semi, slightly random 256 by 256 grayscale image.
But how many options are there?
How many possible images could I have put there?
Well, if we zoom in on that image, you can see all the individual pixels are slightly different shades of gray.
And there are 256 possible shades of gray in an image.
I believe there was a documentary that came out recently, I haven't seen it myself,
which indicated there are a different number of shades of gray.
No, there are two hundred and fifty six.
Because it's stored as an 8-digit binary number.
And 256 is the number of options you have for an 8-digit binary number.
The fact that the sides are 256 is a coincidence, David just picked the same number,
but it is very popular amongst computer people.
If instead David had picked a 2 by 2 grayscale image,
which you can see here, greatly zoomed and enhanced,
the maths is a lot more straightforward.
Each one of those four pixels can be any of 256 colors
If you multiply them all together, you can see there are just over
four billion possible 2 by 2 grayscale images.
For a 256 image, there are a lot more.
How many pixels are there in one of these?
Well if you multiply 256 by 256, you will see there are 65,536 pixels.
What a lovely number!
That is actually one of my all time favorite numbers.
It's a power of two, it's two to the sixteenth,
and that's because 256 is two to the eight,
and so two to the eight times two to the eight gives you two to the sixteen.
Famously, old versions of Excel used to stop after 65,536 rows.
They only had two to the sixteen rows.
Below that it would just, you know, crash or stop.
And one of the other lovely things about it:
as a power of two, none of its digits in base ten are themselves a power of two.
There are no ones, twos, fours, or eights in 65,536.
Go on, find another power of two that doesn't have a power of two digit within it.
I dare you.
So now to work out the total number of possible images,
we just have to multiply 256 times 256 times so on, 65,536 times, once for each pixel.
And if you do that, you get a total number of options of
two to the power of 524,288.
That is a lot of images.
It is approximately 2.6 times 10 to the 157,826.
That is what we call in maths a mind-bogglingly big number.
But David didn't just want to know the number, oh no.
He wanted to know, "How long will it take a super computer to generate all that many grayscale images?"
Now this is where it starts to get a bit silly.
At the time, I gave an adequate answer on Twitter, but I feel like I can do a lot better.
I can try and make that a slightly accessible number.
Spoiler: I'm not going to make it a slightly accessible number.
Okay, so here's what I said.
We'll assume our supercomputer runs incredibly fast.
Let's say it's running at kind of femtohertz rates.
That means it's doing ten to the fifteen things a second.
So we'll say it's flicking through ten to the fifteen of these images every second.
And the universe is currently, well it's 13.8 billion years old, which is approximately ten to the seventeen,
I'm just gonna call it ten to the seventeen seconds.
It's four times that, but frankly that's not going to matter in a moment.
So let's say you have your supercomputer, it's running at a femtohertz,
you set it going from the beginning of the universe, it runs all the way up to now, ten to the seventeen seconds
It will have gone through approximately
none of them.
Seriously, that's not even a registrable fraction of the possible number of images.
So let's say it's done all of that and you go, well I'm gonna set it going again.
We'll rewind, beginning of the universe, run it a second time, through another 13.8 billion years.
But to keep track, I'm gonna take one atom from this universe,
just one single atom, and I'm gonna put it over there in a pile,
I'm gonna make a pile next to our universe.
So I have the observable universe here,
I put a single atom in a new universe over there.
So then I run the computer again, from the beginning of the universe, 13.8 billion years later.
Now, still not done.
I'll tell you what, I'll put a second atom over there in my new universe to keep track.
There are approximately, as an upper bound,
ten to the eighty-two atoms in our observable universe.
So you keep running your supercomputer over and over again,
from the beginning of the universe til now.
Every single time, you put one atom in a new universe.
By the time you have another entire universe,
and I'm aware that is not a universe, that is a galaxy, which is a trivial fraction of the universe.
Yes in fact that's M81, quite a nice one, thank you NASA.
But once you've been running this for long enough to get what is representing another entire universe,
you're still not done.
So you go, "Oh, tell you what, I'll clear that universe, and I will put one atom, one more universe up."
So there's a universe I'm in, there's a universe I've just wiped clean,
and I'll put one atom in the next one up, and then I'll carry on refilling the first one.
Once that gets full again, because I've run that many times through our universe,
I will clear it again and put one atom in the next one, and I'll keep doing that
and eventually I will have refilled the first universe I'm making
ten to the eighty two times and I'll have a whole other second one.
What am I gonna do with that?
Oh I know, I'll reset that one and I'll put one atom another universe down.
I'll have three that I'm working on, I'll keep refilling this one whenever it resets
one atom for the next one, whenever that resets, one atom in the next one.
And once you get that third universe,
you're still nowhere near it.
You'd have to keep doing this for a chain of universes 1,924 long
and by then, you wouldn't be finished.
In fact, you'd only be finished 1,924.3 universes later.
That is a mind-boggling amount of time.
But that got me thinking, if that's how many 256 by 256 images there are,
what if it was color, what if it was bigger?
What if there were several of them, what if they were frames of a video?
How many possible Youtube videos are there?
And we could work that out, because we know the maximum dimensions of what you can get on Youtube.
You can go up to 4k, we know the color depth you can have on Youtube.
Okay, the length of videos gets interesting, but actually,
you don't have to bother working that out because I double checked
and there's actually a maximum file size for what you can upload to Youtube.
It's 128 gigabytes.
And so, that's it, that's an upper bound for the number of possible Youtube videos, 128 gigabytes.
And if you work out what that number is, it's truly insane.
It's just ridiculous, right.
If you set a supercomputer doing one of those Youtube videos every femtosecond,
running from the dawn of the universe until now,
and you set that looping and every single time it loops you put one atom in the next universe
and whenever that resets, the next universe, when that resets, the next universe,
you would have to go down 29,368,779.7 universes.
That's just, I mean, 1,924, I mean that's a number we can get our head around,
but now, 29 million, you can't get an intuitive grasp of a number that big,
and look, and I'm writing it in base universe!
It's a number too big to understand even in base universe.
But it is finite, which is something I find extremely pleasing.
As an example, if you do download the MP3 of the podcast of our first Domestic Science program,
there is a link in the description, and actually, I would kind of hugely appreciate it,
it's completely free, you can download it, listen to it, it's fifteen minutes, you don't have to,
but if you do download it, it does go towards our ratings.
I mean entirely selfishly,
well, you know what, actually, not selfishly,
if you would like to see more science comedy programming,
and not just me, not just Festival of the Spoken Nerd,
across the board, if the BBC sees that doing science comedy gets ratings, they will do more of it.
And if they see there's a big international demand,
they will put more of our episodes and other similar episodes out as podcasts
so I will hugely appreciate it and hopefully you'll enjoy it,
if you would download our podcast from the top link in the description.
But, where I was going with this is if you download it it's 13.9 megabytes.
That is 110,863,792 ones and zeros.
Now that is a very very big number, but it's a finite number.
It's one of a finite number of finite numbers that our podcast could have been.
And it's a number that's existed since before the universe, forget analogies within the age of the universe,
even before the universe, depending on your personal view of the philosophy of mathematics,
that number which corresponds to the binary expansion of the file for our podcast has always existed.
We didn't so much creatively make our science and maths comedy show
as we just picked a preexisting number off the number line,
which does make the whole thing sound a lot less creative, which I am all for.
So David Morrison I hope that's answered your question,
and if you have promised someone you would make all of those images on a supercomputer
well, at least you can tell them you'll have it done within two thousand
powers of universes.
And for everyone else, if you have a question, we'll be doing more of these.
There are four episodes in the series, so you can jump on Twitter and join in.
I believe the hashtag is askthenerds or something suitably organic like that.
And while I am asking nicely for things, you will see my traditional "subscribe to my channel".
Now I know, because I get the stats for people who watch my videos,
that 73.4% of the people who watch my videos are not subscribed to my channel.
I mean well done the other 26.6% of you, you're my people,
that other 73.4, who are those guys? Honestly.
So if you would like notifications--I mean there's literally no--
okay it's not literally no effort. It's not the least you could do.
It is a nonzero amount of effort to subscribe,
but if you do, I mean that does genuinely make a big difference to me
and I hugely appreciate it if you could subscribe as well as download the podcast,
(not very demanding today!) and all that means is down the road
you will get notifications when my new videos go up.
So you also can watch them and enjoy the correct definition of "now".
And that is indeed, all for now.