Hello! This is page 16 of the course called â€śY Combinator for Non-programmersâ€ť. If you just got here, click here to read from the beginning.

Non-programmers

Slide 1 / 16

This is the final page for the advanced levels. Youâ€™re almost done.

Youâ€™re almost done

Looking for some other page?

Slide 2 / 16

As promised, I will return the â€śRepeatâ€ť feature to you.

I will return

the â€śRepeatâ€ť feature to you

the â€śRepeatâ€ť feature to you

Yes! Weâ€™ve got all the features back. We won!

Weâ€™ve got all the features back!

Finally, we can use mathboxes to do additions and subtractions.

Calculates

Calculates

But guysâ€¦ Do you really think itâ€™s over now?

Hmmâ€¦?

Well, we are not done yet!

I still have an important thing I havenâ€™t told you about. Letâ€™s talk about it now.

What? You still have something to say?

Slide 3 / 16

First, take a look at this lunchbox:

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

24

3

34

1

12

Hmmâ€¦ what is this?

It looks like you can fill each of and with a numberâ€¦

Yeah. Try filling each of and with a random number.

Ok. Letâ€™s use:

- for
- for

Fill each of and â€¦

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

24

3

34

1

12

With and

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

24

3

34

1

12

Now, letâ€™s use this lunchbox that can be converted to â€¦

â€™s with on the bottom-right

â†’ Can be converted to

â†’ Can be converted to

12

2

1

And this lunchbox that can be converted to :

â€™s with on the bottom-right

â†’ Can be converted to

â†’ Can be converted to

123

3

2

1

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

24

3

34

1

12

Use lunchboxes that can be converted to

and

and

2

12

2

1

1

123

3

2

1

12

24

3

34

1

12

Ok, letâ€™s see what happens when you run it.

Slide 4 / 16

Letâ€™s run it.

- Itâ€™s complicated, so you donâ€™t need to follow all the steps. Save your eyes!
- If you canâ€™t wait, press â€śSkip to the end â†’â€ť.

2

12

2

1

1

123

3

2

1

12

24

3

34

1

12

It became this lunchbox that can be converted to .

â€™s with on the bottom-right

â†’ Can be converted to

â†’ Can be converted to

12345

5

4

3

2

1

Slide 5 / 16

Now: What numbers did you use for and ?

I used and , and the final result was â€¦

If we used and â€¦

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

24

3

34

1

12

The final result was

Lunchbox that can be converted to

Does that mean: It calculated ?

It can do addition?

Exactly! Using the above lunchbox,

- If you fill each of and with some numberâ€¦
- It calculates .

If you fill each of and

with some number and run itâ€¦

with some number and run itâ€¦

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

24

3

34

1

12

It will become a lunchbox that can be

converted to

converted to

Lunchbox that can be converted to

So: The above lunchbox can do addition of two numbers.

It can add two numbers

Oh wowâ€¦!

We thought we had to use the â€śRepeatâ€ť feature to calculate additions like this:

Calculates

2

1

1234

4

3

2

1

12

1

12

2

1

1

12

2

1

But it looks like we can do addition of two numbers without using the â€śRepeatâ€ť feature .

Exactly!

Slide 6 / 16

Next, how about this lunchbox? What do you think this lunchbox can do?

What can this lunchbox do?

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

12

2

1

Itâ€™s similar to the previous lunchbox but slightly different.

Letâ€™s fill and with and like the last time, and see what happens.

Use for and for

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

12

2

1

Use lunchboxes that can be converted to

and

and

2

12

2

1

1

123

3

2

1

12

12

2

1

Ok, letâ€™s run it.

This one takes time, so if you canâ€™t wait, press â€śSkip to the end â†’â€ť.

2

12

2

1

1

123

3

2

1

12

12

2

1

It became a lunchbox that can be converted to .

â€™s with on the bottom-right

â†’ Can be converted to

â†’ Can be converted to

123456

6

5

4

3

2

1

Slide 7 / 16

We started out with for and for â€¦

And the result was .

We started out with and â€¦

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

12

2

1

And the result was

Lunchbox that can be converted to

Maybe: It can do multiplication?

It can do multiplication?

Exactly! Using the above lunchbox,

- If you fill each of and with some numberâ€¦
- It calculates .

If you fill each of and

with some number and run itâ€¦

with some number and run itâ€¦

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

12

2

1

It will become a lunchbox that can be

converted to

converted to

Lunchbox that can be converted to

So, itâ€™s a lunchbox that can calculate multiplications.

It can calculate multiplications

Slide 8 / 16

By the way, we donâ€™t have time to explain this, but lunchboxes can also do subtractions and divisions of two numbers.

So: Lunchboxes can do addition, multiplication, subtraction, and division.

Lunchboxes can do addition, multiplication,

subtraction, and division

subtraction, and division

Slide 9 / 16

Whatâ€™s coming up next is the final topic weâ€™ll cover. Youâ€™re so close to the finish.

Youâ€™re so close to the finish

Slide 10 / 16

Furthermore, lunchboxes can do even more complicated calculations.

Like what?

For example: Lunchboxes can calculate factorials.

Factorials? Whatâ€™s that?

The factorial of a number can be calculated as follows:

- Start with a number, say , andâ€¦
- Keep multiplying it with smaller numbers (each number is 1 less than the previous number)â€¦
- Until you reach .

Factorial:

Start with a number and keep multiplying

with smaller numbers until you reach .

Start with a number and keep multiplying

with smaller numbers until you reach .

Hmmâ€¦ Can you give me an example?

For example: This is the factorial of . If you do the math, the result will be .

The factorial of .

If you do the math, the result will be .

If you do the math, the result will be .

Another example: This is the factorial of . If you do the math, the result will be .

The factorial of .

If you do the math, the result will be .

If you do the math, the result will be .

Ok, I think I got itâ€¦

Now, I will show you that: Lunchboxes can calculate factorials.

Slide 11 / 16

To calculate factorials, we need to use the lunchbox that can do multiplication (which we saw earlier).

But this time: Instead of using the actual lunchbox, weâ€™ll use the following notation (abbreviation):

Instead of the actual lunchboxâ€¦

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

12

2

1

Weâ€™ll use this notation (abbreviation)

1

1

In this notation, the icon in the middle indicates multiplication.

The icon indicates multiplication

Hmmâ€¦ ok, but why do we need to use this notation instead of the original lunchbox?

Itâ€™s because: The lunchbox that calculates factorials is going to be very complicated.

Therefore: We need to use this simpler notation to describe multiplications in order to save some space. Otherwise, the lunchbox will be too big.

Weâ€™ll use this notation to

save some space

save some space

I seeâ€¦

Before we move on, letâ€™s take a look at an example that uses this simpler notation.

For example: This is the earlier lunchbox that calculates :

A lunchbox that calculates

2

Lunchbox that can be converted to

1

Lunchbox that can be converted to

12

12

2