The villagers in Lambda Village were struggling with this difficult problem:
Hmmā¦ I have no idea.
But we need to solve this to get our mathboxes back.
Looking for some other page?
Thatās when Saya , a little girl who lives in Lambda Village, appeared.
Hey guys! What are you doing there?
Hi Saya. Well, we have some bad news. The devil has taken our mathboxes .
To get them back, we need to solve this difficult question. But itās too hard for us.
I see. Iāll help you then!
We appreciate it, but this isnāt for kids.
We tried hard but couldnāt solve it. I donāt think you can do it.
Saya spent some time thinking, and came up with the following lunchbox:
Hey, I filled each icon as follows. Can you take a look?
Hmmā¦ I donāt think itās going to work, but weāll try anyway.
Weāll run this, and see if the result is a lunchbox that can be converted to .
Letās run it!
First: Because there are multiple pairs of 1ās, we start from the leftmost pair.
Press Run . (Or press to step through manually.)
Second: We canāt start with the leftmost pair of 1ās because thereās only one item on the bottom (a sandwich ).
Therefore, we do the pair of 2ās.
Press Run :
Third: Weāll need to start with the pair of 2ās again, just like the last time.
Press Run :
So this is the final result.
Ohā¦! This isā¦
The resulting lunchbox can be converted to .
So, itās a success!
Yay!
No way! Canāt believe Saya solved it so easily!
Surprise: Saya just solved the devilās difficult problem.
Wow, Saya, youāre awesome. Thank you for solving it!
Sure thing!
Thanks to Saya, weāll get our mathboxes back!
Yes, but: Before we move on, letās dive in a little deeper.
Weāll spend a bit of time to talk about some important stuff.
Hmmā¦ ok, let me hear what you have to say.
First: Hereās what weāve learned so far. Hereās a lunchbox that can be converted to :
If we combine it with Sayaās lunchbox, it will become a lunchbox that can be converted to .
So, by using Sayaās lunchbox,
Now, hereās a question: Suppose that we combine Sayaās lunchbox with a lunchbox that can be converted to .
What do you think happens when you run it?
Hmmā¦ I have no ideaā¦
Last time, became . Donāt know what will happen this timeā¦
Letās check!
This time, weāll use this lunchbox that can be converted to .
Letās combine it with Sayaās lunchbox.
Letās run it. This time, weāll continue running until the end without stopping.
You can also skip to the end.
The resulting lunchbox can be converted to .
That meansā¦
That means: By using Sayaās lunchbox, became .
So, by using Sayaās lunchbox:
Do you see the pattern?
Maybeā¦it can add ?
Exactly!
In other words: becomes .
Thatās why āit can add .ā
Now, letās recall that: Mathboxes have the āPlus 1ā feature .
Using a mathbox, you can use the āPlus 1ā feature to add to any number.
And on this page, we learned that: You can also add to a number using a lunchbox .
Hereās how: Instead of , by using Sayaās lunchbox, you can add to a number.
Therefore: A mathbox that uses the āPlus 1ā feature can be āreproducedā using a lunchbox.
So, to add 1 to a number:
Of course, you can also reproduce more complicated mathboxes.
For example, take a look at this mathbox that appeared on Beginner 1. If you run it, the result will be .
Can you figure out how to reproduce this using a lunchbox?
I got it!
First, weāll use this lunchbox that can be converted to :
Then, use my lunchbox twice:
Correct! Letās run it to check.
(To save time, weāll skip right to the end when you run it.)
The resulting lunchbox can be converted to .
Therefore, we were able to reproduce the earlier mathbox.
Summary: A mathbox that uses the āPlus 1ā feature can be āreproducedā using a lunchbox. As long as you understood this, you donāt need to understand all the details.
Note: There are other lunchboxes that can reproduce the āPlus 1ā feature . Sayaās lunchbox is not the only solution.
If youāre curious, press āContinue readingā below. (Itās optional.)
Remember that: In Beginner 1 and 2, we explained that mathboxes also have other features, which are:
Question: Can we also reproduce these features using lunchboxes?
You donāt need to answer this question now: Weāll talk about this soon.
Hey Minion, I want to tell you somethingā¦
Sure, whatās up?
The problem on the last page was too difficult! Thereās no way we couldāve come up with an answer as quickly as Saya did.
Maybe computer science is too hard for usā¦?
Oh, donāt worry! The problem was very difficult. We didnāt expect you to answer it.
You donāt need to be able to answer questions like this to learn computer science.
Oh, really?
As long as you understand it after looking at the answer, youāll be fine.
Okā¦ I feel much better now. Thank you, Minion!
No problem. Letās get back to the story.
The villagers are all very happy that the question is now solved.
Thanks to Saya, we solved the difficult question.
That means weāll get our mathboxes back.
However: Saya doesnāt seem too happy.
Hey Minion, I noticed something very strangeā¦
Oh really? What do you mean?
What strange things did Saya notice? Letās take a look on the next page.