Today, I'm going to give you a puzzle based on an A4 piece of paper.

Now, very sadly, if you're watching this in Canada or the United States of America,

your letter paper is not this size. You have a different ratio paper.

In fact, the North American "Letter" size is around about 0.7083 feet across the top,

and then this length here is 0.001389 furlongs.

I mean, I forget the exact details.

Whereas in the rest of the world, our paper is such that, if you had a single unit length across the top, there,

so, let's say that's just 1, then the ratio to the side here is always exactly √2.

And that's what we need for our puzzle today.

But don't stress if you can't find some A4 paper,

merely pick up your nearest piece of Freedom Paper™, and just pretend it's this ratio.

The puzzle will still work.

For this puzzle, we're gonna start with our A4 piece of paper.

We're gonna take one corner, and we're gonna fold it all the way down 'til that top edge meets that side edge over there.

And this is what you would do if you wanted to make a square of paper,

cause you could now cut off this little rectangle at the bottom, and you'd be left with a perfect square at the top.

What we're going to do, however, is leave it down there,

and on this surplus bit of paper, we're gonna take one corner, and fold it up and over, so it meets the same centre line there.

And the puzzle is "What is the perimeter of this shape?"

Because before, when we started, the perimeter of the entire piece of paper,

if that's 1, that's 1, we've got √2 and then √2, the total perimeter is 2+2√2

But, once we fold that in, we fold that in, what is the new perimeter of this shape?

And, as a kind of side puzzle, what is the name of this shape?

That is one of my favourite puzzles. Not only because the process of working it out is, I can guarantee you, a lot of fun.

But the final answer is a bit of a nice surprise. It's good to have a puzzle where the answer is rewarding!

The only issue is, if you already know the answer, it takes a whole lot of the fun out of it.

And so I don't want anyone to put the answer on Twitter, don't put it in the comments underneath the video,

I want you to keep quiet and let people work it out for themselves.

The only problem here is that a lot of you, like me, at the end of a lot of working out, want to know we got the answer correct.

And how can you check your answer if I don't tell you what the right solution is?

Now, the normal solution to this is that I would release another video a bit later on, but there are two major downsides to that.

First of all, for all my fantastic subscribers who watch these videos as soon as they go online, you've now got to wait.

Beyond that, the second problem is, once the solution video is online, it's very tempting just to look it up,

and from my point of view, there's actually not that much more I can add to the puzzle once you know you've got it correct.

There's no fantastic extra hidden bit of mathematics I can show you.

Just working it out, and getting the answer, is brilliant on its own.

And so my solution is to give you a way you can check your answer, without knowing in advance what the answer is.

We're gonna do it with the help of this number here: 234477

If you take the correct answer to this puzzle, put it into a calculator, hit the square root (√) key five times,

look at the answer, after the decimal point if you take the first six non-zero digits, and put them in numerical order,

you get 234477

So, if you do that process to an answer, and you don't get 234477, you know you haven't got the right answer.

But yet, you can't take 234477 and reverse it to work out what the answer should be in the first place.

Let's do a quick example: say you think the answer is 42 because you're hilarious.

You simply take your calculator, you type in 42, we then hit the square root (√) key five times: here we go.

One, two, three, four, five.

We have an answer there. If I go after the point, I've got 123897

So, in numerical order, that would be 123789

And it doesn't match the number I gave you before; we know, in this case, 42 is not the answer.

What I'm doing here is using something called a hash function.

In computing, a hash function is something that takes any kind of input of arbitrary size,

crunches it around, and spits out an answer of a very set length.

An answer which, for the same input, is always exactly the same,

but, given just the answer, you can't reverse it to work out what the input was.

Hash functions are used all the time in computing to solve problems with simplifying and verifying information,

and so it pleases me immensely that I can use a hash function so you can verify your solution to a mathematical problem.

There are a few problems with my five square root hash function.

For a start, even though I tried to make sure you can't easily reverse it to get back to the answer -

things like taking out the zeroes, rearranging the digits into numerical order,

hopefully hide the path that got to the number in the first place -

it can, technically, if you've got enough time on your hands, be rolled backwards.

But, I can guarantee you, reversing it would take a lot more effort than merely solving the puzzle in the first place.

On top of that, there's a chance you might get the correct hash by accident,

because I've thrown out the zeroes and rearranged the digits, there are actually only 5004 distinct outputs from my hash function.

And so there's a 0.02% chance you'll get the correct one with an incorrect input.

But that's not so bad. I'm prepared to live with that tiny chance of a hash collision

For the record, real computer hash functions suffer from the same vulnerabilities as my ridiculous "play hash" function.

For a real hash function, the input data is rolled right back to its binary encoding, and then that is crunched.

All sorts of ridiculous algorithms are deployed on top of it; it obliterates the path.

There is no way, in a reasonable time frame, you could roll back the hash to the input data.

And to avoid collisions, real hash functions have much bigger outputs.

If I took the solution to this puzzle, and put it into something like the SHA-256 hash function,

which is what's actually used in Bitcoin, you would get this Base64 monster out the other side.

With something like this, you're not gonna get hash collisions trying to solve this puzzle.

But for something like what I needed, where it had to be easy to do by hand,

I went for a much more simple, straightforward function, and I accepted a much higher risk of collisions.

There you are! Thank you very much for watching my video about this ridiculous shape.

And the computing concept that is the hash function.

If you haven't already subscribed to my channel, and you would like to now, just click anywhere on that ridiculous shape.

If you would like to watch more about these things, you've got two good video options I would recommend.

You can either watch the apology I had to issue last time I talked about paper ratios and made fun of the imperial system.

It's, er, totally worth it.

Or, you can watch the Numberphile video, where James Grime explains why A4 paper uses the √2 ratio,

and why that's so wonderful.