This activity is part of the module "Code by Numbers" which can be downloaded as a complete booklet from the STEM section of the website. In this activity students explore the Euler Totient function, it sounds complicated, it's not, just really neat! The function determines the quantity of numbers that are co-prime up to the selected number (n). Students write some relatively simple code, chunking previous code to simplify the algorithm. There are so many observable patterns when studying the Euler Totient function for a set of numbers. Finally, students see a short cut method to perform the calculation. It's absolutely brilliant.
This activity covers multiple objectives including improved number sense, pseudo-coding, coding, algorithmic thinking, problem solving and investigations. Students also see the power in representing numbers in different forms, including as a product of its prime factors.
- HCF or GCD
- def function
- % (Modular Arithmetic)
About the Lesson
This activity is Part 3 of the series Code by Numbers. This activity requires students to turn the Euler Totient function into some relatively simple Python code. Students are then able to explore some of the many patterns generated by this function. Finally, students explore a simple formula that can be defined to calculate the result, based on the prime factorisation of the selected number. There are so many benefits to an exploration such as this, students see that representing numbers, and by corollary, algebraic expressions, in different forms can provide so much more information. Expanding and factorising is not just a process, its a preference.