Loading...

Hello everyone, it's Mr. Millar here.

In this lesson, we're going to be looking at the happy caterpillar problem.

So, first of all, I hope that you are all doing well and in this lesson we're going to be looking at the happy caterpillar problem, which hopefully will be a lot of fun for you.

So without further ado, let's check out how this one is going to work.

So, a caterpillar starts with a number between one and 100.

So you can see that this first caterpillar has started off with a 7 and the second one has started off with a 24.

So, if that number is odd, the caterpillar will add one.

If it's even, the caterpillar will divide two.

It will keep on doing this until it gets to one.

So let's have a look and go through the first caterpillar which has been completed for us already.

So we can see that it starts off with a seven.

And because seven is odd, we're going to add one, and seven plus one is eight.

Now eight is even, and if it's even we divide by two.

So eight divided by two is going to give me four.

Four is even, so we divide by two and we get two.

And two is even, so two divided by two gives me one.

And then the caterpillar stops.

So because we've got one, two, three, four, five numbers in our caterpillar, we can say that the caterpillar has got a length of five.

Now how about a caterpillar which starts off with 24? What happens here? What is the first step first of all? Okay, well, the first step is divide by two because 24 is even of course.

So if we divide by two, we get a 12.

Okay, so pause the video now and see if you can complete the rest of this caterpillar by yourself.

Great.

So you should have divided by two as the next step to get six.

And then we can keep them going.

So six divide by two is equal to three.

But when you get to three, three is odd.

So if I continue with down here, we're going to have to add one to get four.

And now four is even, so we're going to have to divide by two to get two.

And then finally divide by two and we get one.

So, hopefully your caterpillar looks a little bit better than mine, but anyway, the point is that to find out what length it is, we have to just count up all the numbers and I can see that we've got seven numbers here.

So it's length is seven.

So that is the idea of how this works.

But all you need to do is remember that if a number is odd, we add one, if a number is even we divide by two.

Let's move now to the connect task.

Okay.

So here, I've got three caterpillars here.

One starts at 50.

One with 32 and one with 10.

And what I want you to do is to complete each of these caterpillars and then find out which one is the longest and which one is the shortest.

So you will start off with the 50 caterpillar by first of all, dividing by two and then seeing how that works out.

So anyway, pause the video now and see what you get.

Great.

So let's go through these.

And I'm not going to draw out pretty caterpillars, but I'm just going to do it in a shorthand way which you could do as well, if you want to.

So anyway, the 50 caterpillar starts off with 50 and then we divide by two to get 25.

25 is odd, so we add one to get 26.

Divide by two to get 13.

And then we're going to add one to get 14.

And then divide by two to get seven.

Add one to get eight.

And then divide by two, divide by two and then divide by two to get one.

We stop at one and then we can count up the number of, numbers that we have.

So we have the length of 10.

Next one, 32.

So we just get 32 divide that by two, 16.

Then we get eight.

Then we get four, then two and then one.

So that is a length of six.

And finally 10, we do 10 goes to five.

Add one to get to six.

Divide by two to get three.

Add one to get four.

And then two and one, that's over.

And this has a length of seven.

And so we can see that the caterpillar of length 50 is the longest and caterpillar of length 32, the shortest, which is actually quite interesting to note that even though 32 is a bigger number than 10, it ends up giving a smaller caterpillar.

Anyway, interesting idea.

We're going to come back to this idea in the next slide.

So let's have a look at the independent task.

Okay.

Let's look at the independent task.

So for this task, you need to work out the shortest caterpillar which starts off with the length between 10 and 20.

And explain why this number gives the shortest.

So, what you need to do is you need to look at different numbers.

So starting off with a caterpillar of length 10, and a length 11 and 12, et cetera.

You need to find out how long each of these are and which number will give you the shortest link.

So for example, if you are going through number 11 'cause we've done 10 already.

We start off with 11, we add one we get to 12.

And then six and then three.

And then four, two and one.

So therefore we know that if it starts off with 11, it is length seven.

And we can do it the same for the other ones.

So that is what you need to do now and see if you can find which number gives you the shortest length.

Pause the video for a couple of minutes and have a go at this problem.

Okay, great.

So I hope that you work this out and well done for finding out the correct answer.

The length, which gives you the shortest is actually 16, because in this case we get 16, then eight and then four, then two then one.

So it is a length of five, which is the shortest length you can get if you start between 10 and 20.

Which is again really interesting as we saw on the previous slides, that 16 is a bigger number than 10 and 11 and 12, et cetera, but it gives us a shorter line.

So can you think why that is? Well, the reason is that as you can see, each time we are dividing by two, so divide by two, divide by two divide by two divide by two.

So we're getting smaller and smaller as quickly as we can.

And no point in this chain, are we adding one.

And well done for spotting that this works for 16 because 16 is a power of two.

In case you spotted that, well done.

Anyways, so you found out that 16 is the shortest, and we're going to keep this idea in mind when we have a look at the next task.

Okay.

So let's have a look.

There are rumours of a caterpillar with length 14.

What number could produce such a beast? So here we have a huge caterpillar of length of 14.

And just remember that it has to start off with a number between one and 100.

So we can't have any more than 100.

So this is a very tricky problem.

So if you're feeling like you don't need any clues at all and you can have a go yourself, then pause the video now, otherwise I'll give you a clue in a couple of seconds.

Okay, great.

So if you need a clue, here is a clue.

And if you read what's in the speech bubble, I'm going to be working backwards here.

So I know that I have to finish off with a one.

And the only way to get one is to have a two before that.

There's no other way to get a one.

You have to have the two before that.

So you're going to be dividing by two and have the last step there.

So how do we get the two? Well, we know that to get from here to here, we can either add one or we can divide by two.

Those are the two options.

But actually we can't add one because that would mean having a one here.

So that is not going to work.

So therefore we have to have a four here and we have to be dividing by two again.

But now, if you think about going up from here to four, again, there are two possibilities.

Divide by two or add one.

And now we do have a choice.

And the choice here is between, of course, add one, divide by two.

And to get a longer chain, it turns out that we're going to need to add one.

So we're going to have a three here.

So see if you can use this idea to see if you can get the longest, to get the chain, a caterpillar with like 14.

So pause the video now, and see if you can work this out.

Great.

So well done if you did manage to work that out.

And I'm just going to go through a few more steps with you.

So we need to have a six here.

So this would be divide by two.

And then the next one, well, this time again, we're going to be adding one here.

So we're going to have a five here.

And you should be spotting a pattern now that we are going to be dividing by two, then adding one and then alternating around.

So if we just continue this pattern, we get the longest possible chain.

So we're going to have a 10 here, a nine here and then an 18.

Then a 17, 34, 33, 66 and 65 here.

And that gives you the, that is the starting number that gives you a length of 14.

So really well done if you managed to work out that this was a 65 here, cause that was a tricky question.

And the final question I have for you is, there are six different numbers between one and 100, which gives you a length of 13.

So six different numbers for you to find out.

So see if you can find out those numbers.

Pause the video now, before I give you the answers.

So if you managed to work this out, really well done.

It's six numbers between one and 100 which gives you a length of 13.

Well done, if you managed to find those.

Right, that is it for today.

Hope you enjoyed these two lessons.

Thanks very much for watching and I'll see you next time.

Thanks very much.

Have a great day.

Bye, bye.