So, 4 is out,

I start from the fifth and now I go; 1, 2, 3,

4, 5, 6, 7, 8, 9, 10,

11, 12,13, 14, 15,

16, 17, 18, 19.

So, okay, this is out.

So, the 2 is out,

and I would start again on the third sweet.

That's going to take a long time.

We can do better than that because, really,

we're wrapping around the number 19 around the number of sweets, around five sweets.

So, that means that 19 covers

the five sweets three times and then there's four more words to use,

so the fourth chocolate is out.

Yes, that's what we got.

Then I start counting on the fifth,

and I've got four chocolates to count over.

Nineteen covers it four times,

that's 16, and then there's three more words left.

So, the third chocolate after the fifth,

which is a third, that is number 2 and that is out.

Then I've got three chocolates left.

I start on the third chocolate,

19 covers it six times,

that makes it 18, then there's one word left.

So, the third chocolate is out.

Then I'll do it again.

I have two chocolates left.

I start on the fifth and then I'll just go even and odd,

even and odd, alternating between the fifth and the first,

and the fifth is out.

So, I will eat the first sweet first.

I'll eat my cupcake first.

You can do it yourself with your treats,

and check my math.

So, we really didn't need to do the counting around every time.

What we needed was the remainder of the division of 19,

by how many sweets were left on the table.

So, 19 divide by 5 is 3, with remainder 4.

So, the fourth chocolate is out and I start on the fifth.

So, I've got the fifth, the first,

the second, and the third available.

Then starting on the fifth,

I'll do 19 divide by 4, which is 4,

remainder 3, and from five,

one, two, the second is out.

Then I start on the third chocolate,

and I have the third,

the fifth, and the first.

So, 19 divided by 3 is 6, with a remainder 1.

So, the third chocolate is out.

Then I start on the fifth chocolate.

I've got the fifth and the first.

19 divided by 2 is 9 with remainder 1.

So, the fifth chocolate is out,

and so, I will eat the first.

All we needed were the remainders.

This wrapping around numbers and requiring only remainders of division,

is the core of what we do in modular arithmetic.

You and I use it every day to work with hours and minutes and seconds.

You see, 20 minutes after 1:56 PM, it's 2:16 PM.

You add 56 minutes with 20 minutes,

that makes 76 minutes,

and then you take away the 60 minutes,

giving you 16 minutes past the hour.

Then that extra 60 minutes,

you convert into one more hour,

so you add 1 to the 1:00 PM,

making it to 2:16 PM.

Modular arithmetic is often referred to as clock arithmetic.

But instead of working always with 60 minutes of 12-hour clock faces,

we work with the size of the clock we need for each problem.

With the chocolates, we did 19 divide by 5 equals 3 with remainder 4.

So, here we were working with a clock face with five hours.

When we did 19 divide by 4 equals 4 with remainder 3,

we actually want a clock face with four hours.

19 divide by 3, which was 16 with remainder 1,

we were working on a clock face with three hours,

and 19 divide by 2,

which is 9 remainder 1,

we actually want a clock face with two hours.

Well, the two-hour clock just highlights if the number we were working is even or odd.

Like in binary, odd numbers end with a one and even numbers end with a zero.

What's cool about this concept of working with remainders of division is that

the rules of arithmetic are very similar to the ones with common numbers.

What I mean is that,

45 divide by 4 leaves remainder 1,

and that's because four times 11 is 44,

and that's the highest multiple of 4 fitting into 45.

So the remainder is 1. I'll write that.

So, 45 divide by 4 leaves remainder 1.