*(c) George Gadanidis, 2021*

*Designed to serve as a base lesson plan — a set of activities to select from and adapt — for diverse learning settings (f2f, hybrid, online, parents/children)*.

*Although designed with the Ontario 1-8 math curriculum in mind, this workshop would be of value to all educators interested in learning how to integrate math + coding. *

*Based on our collection of math + coding lessons.*

## WORKSHOP OVERVIEW

#### MENU

#### EXPECTATIONS

## A. ODDS, EVENS & NATURALS — CONCEPT MAP

The Venn diagram below shows a low floor, high ceiling mapping of the topic of odds, evens & natural numbers.

You can also see the Venn diagram as a mapping of the topic of linear & non linear relationships.

The opportunity to **see one idea** (odd & even patterns)** as another** (linear and non-linear relationships), and **across multiple representations** (concrete, numeric, visual, graphical, algebraic, with code) helps anchor and develop **conceptual understanding**.

## B. ODDS, EVENS & NATURALS — HANDS-ON

#### CONCRETE/VISUAL REPRESENTATIONS

1. Can you see odds, evens & naturals in the images below?

**A.**

**B.**

**C.**

**2. **Match each of the images above with 3 of the numeric / algebraic representations below:

**A.**1 + 3 + 5 + 7 + …**B.**N**C.**N(N+1)**D.**1 + 2 + 3 + 4 + …**E.**2N-1**F.**2 + 4 + 6 + 8 + …**G.**2N**H.**N(N+1)/2**I.**N x N

## C. ODDS, EVENS & NATURALS — WITH CODE

In this section, we will use a Python coding environment, provided by the University of Waterloo, to represent number patterns with code.

#### Listing number PATTERNS WITH PYTHON

**1.** Go to cscircles.cemc.uwaterloo.ca/console and enter the Python code below.

**2.** Run the code to see this output:

**3.** Edit the code to list the first 10 even numbers.

**4. **Edit the code to list the first 10 odd numbers.

**5.** Edit the code to list the first 10 natural numbers.

**6.** Explain how the code works.

#### COMPARE PYTHON & SCRATCH

**7. **See/run this Scratch code at https://scratch.mit.edu/projects/472091993/editor

**8.** Edit the code to list the first 10 odd numbers.

**9. **Edit the code to list the first 10 natural numbers.

**10.** Explain how the code works.

**DEFINED COUNT**

The code blocks listed below (a) initialize and (b) increase the value of a **variable** called “**counter**“.

(a)

(b)

This is an example of what is referred to as “**defined count**“.

#### CODE EFFICIENCY

**11.** Compare the Python code and the Scratch code needed to list number patterns.

- Which code more efficient?
- In what way?
- Justify your reasoning.

## D. SUMS OF ODDS, EVENS & NATURALS — WITH CODE

#### SUMS WITH PYTHON

**1.** Go to cscircles.cemc.uwaterloo.ca/console and enter the Python code below.

**2. **Run the code to see this:

**3.** Edit the code to list the first 10 even numbers and their sums.

**4.** Edit the code to list the first 10 odd numbers and their sums.

**5.** Edit the code to list the first 10 natural numbers and their sums.

**6.** What patterns do you notice?

**7.** Notice line 4 in the Python code. What does “=” mean in this case?

**8.** How is this different from how we use “=” in math?

**9.** Explain how the code works.

#### LINEAR & NON-LINEAR GROWTH

**Linear** means that a pattern has a **constant rate of change**, like how the height changes as you climb a staircase.

**Non-linear** means that the rate of change is not constant.

**10.** How do even numbers grow compared to how their sums grow?

**11. **What do “linear” and “non-linear” mean in this context?

## E. PLOTTING NUMBERS & SUMS — WITH SCRATCH

#### PLOTTING NATURALS & EVENS

The Scratch code below plots natural and even numbers.

Notice that the code uses 2 **subprograms**, called naturals and evens.

Subprograms make code easier to read and understand. They can also make code more efficient.

**1.** Go to https://scratch.mit.edu/projects/494212076/editor to see and run the program. The output should look as shown below.

**2.** Looking at their graphs, are the natural and even numbers linear or non-linear patterns? Justify your reasoning.

**3.** Are all of the natural and even numbers plotted? Explain your reasoning.

**4.** Rename the subprogram **evens** to be called **odds**.

- click on
**My Blocks**in the left menu

- right-click the
**evens**block, and select edit to rename it

**5. **Edit the code to plot odd rather than even numbers.

**6.** Are odd numbers a linear or non-linear pattern?

**5.** Run the code to see the new output.

**7. **Study the code. Explain how it works to plot the number patterns.

#### PLOTTING NATURALS & THEIR SUMS

The Scratch code below plots natural numbers and their sums.

Notice that the code uses 2 **subprograms**, called number and sum.

**1.** Go to https://scratch.mit.edu/projects/494213855/editor to see and run the program. The output should look as shown below.

**2.** Notice that x starts with a value of 4.

**3. **Also notice that x is increased by 4

**4.** And the process repeats 60 times.

**5.** Which natural numbers are considered in the code below?

**6.** Which natural numbers and sums are actually plotted on the graph?

**7. **Edit the code as shown below. How do the graphs change? Why?

**8.** Edit the code as shown below. How do the graphs change? Why?

**9.** Looking at their graphs, are the natural numbers and their sums linear or non-linear patterns? Justify your reasoning.

**10. **Edit the code to plot even numbers and their sums.

**11.** Run the code to see the new output.

**12.** Are even numbers and their sums linear or non-linear patterns?

**13. **Study the code. Explain how it works to plot the number patterns.

#### DATA ANALYSIS

In the above activities, you used Python and Scratch code to list and to plot patterns related odd, even and natural numbers and their sums.

Representing the patterns as numeric and graphic data, along with the ability to edit the code and dynamically see what changes, is a powerful form of data representation and data analysis.

Based on this data analysis, what decisions can you make about the nature of the graphs of odd, even, natural numbers, and their respective sums?

## F. PLOTTING NUMBERS & SUMS — WITH PYTHON

The Python coding platform used here is Google’s CoLab.

This platform uses a Notebook version of Python, where you have both text cells and coding cells. So in effect, you keep a notebook where some of your cells are live code and some are text, graphics and video, to help you elaborate.

Scientists use these types of Python Notebooks (known more generally as Jupiter Notebooks) to write about their research, and make their findings and analysis (the coding behind the numbers in their data) public, so other scientists may verify and extend their work.

Students need to log in with a Google email address to access all the features of coding platform (create and save their own Python programs).

Here is the link to this code: https://colab.research.google.com/drive/1LfbK-USfaVoO6IyaGR-FSpITUup-1E1d?usp=sharing

**1.** How is the Python code shown above different from or similar to Scratch code and the Python code we used previously?

**2.** Which part is similar?

**3.** How is the output different?

- The output self-adjusts to fit the graphing window.
- Lists are used to store data, and then the graph is created for the lists.

**4.** Edit the code to plot odd numbers and their sums.

**5.** Edit the code to plot natural numbers and their sums.

# G. REFERENCE VIDEOS

#### WHY MATH + CODING?

**The affordances of modelling math with code** (6 min.)

#### Odds & evens

Lyrics based on teacher comments after investigating odd and even patterns.