# How to mix Maths & Computing using Scratch

I have the pleasure of teaching two great Year 9 classes this year. One is a fabulous Maths group that I have taught for the past two years, another is an ICT taster class (we have brought taster options into Year 9 this year, allowing students to get a taster of KS4 courses – this group is doing a few months of Computing and a few months of Creative iMedia).

To introduce the concepts of variables, if statements and loops in the Computing class we’ve been working with Scratch. We already use Scratch in Y7/8 to cover some of the control aspects of the old curriculum. This normally takes the form of a simple maze game.

Being the Mathematician that I am some simple Maths challenges seemed like a good place to start. We’ve created a times table machine that lists the first 10 numbers in any times table and a host of other challenges that a colleague of mine wrote.

This week I set them the challenge of writing a program that found all the factors of a number. This used the mod function to check for a remainder when dividing, a loop an if statement and a list (Scratch’s 1 dimensional array) to store the answers in.

Here’s an example of what this looked like:

This worked so well I realised that this was a great way to teach Maths too! Coming up with a solution to this problem really gets to the bottom of what a factor is and how you can calculate it.

With this in mind I took advantage of a double lesson with my Maths group to very quickly teach them the basics that we’d covered in Computing and set them the same challenge. We also then moved onto checking whether the number was a prime (by checking the number of factors in the final list, if = 2 then it’s a prime). We left the class discussing whether it would be possible to make Scratch calculate the Highest Common Factor of two inputs. I wasn’t sure if it was up to it, but a little work at home and I’ve managed to make it work:

I was pretty proud of myself. I plan to set this little challenge to the class this week as a homework and see if anyone can come up with a solution. It’s probably more of a programming challenge than a Maths challenge but either way I think it’s a great little challenge and I’m continually impressed with the flexibility and scope of Scratch.

I’m particularly excited to see what Scratch 2.0 has in store for us.

I’ve used Scratch years ago as a LOGO replacement in Maths too, writing a program to draw regular polygons is a great challenge to develop an understanding of internal/external angles.

With this in mind I’m planning to teach at least one topic each half term this year using Scratch with my Maths class.

As for the Computing group, next challenge was a game of FizzBuzz, more on that in a future post.

If you’d like to download and play with the Scratch programs mentioned then click to download:

What Maths have you taught via programming tasks? Ideas and examples would be most welcome in the comments!