# Program the Tower of Hanoi Puzzle

**Resolution:**Individual, Group

**Duration:**Two to four hours

## Overview

### Goals

The purpose of the activity is to demonstrate the principle of recursion through a classic mathematical problem, namely the Tower of Hanoi. Students are called to introduce. Furthermore, the activity aims to build students skills in applying mathematical concepts, such as recursion in programming, to derive recursive and non-recursive formulas to mathematical puzzles, to program precise solutions, and to explain the mathematical concept of recursion to peers.

### Learning Objectives

Upon completion of the activity students will: - Understand the concept of recursion - Be able to extract a recursive formula for the Tower of Hanoi puzzle - Be able to program a recursive solution for the Tower of Hanoi puzzle - Be able to extract a non-recursive formula for the Tower of Hanoi puzzle - Be able to program an non-rescursive solution for the Tower of Hanoi puzzle - Be able to explain to peers the recursive and non-recorsive solution to the Tower of Hanoi puzzle and the benefits of each

### Context

The activity is to be implemented in the context of discrete mathematics for engineering activities as well as programming activities. It is a useful exercise for early engineering education, and it is often introduced into learning at freshman computer engineering and computer sciences courses. The activity aims to demonstrate the links between discrete mathematics and programming. The activity may be used more generally in activities aimed to build problem solving capacity. It challenges students to analyze a problem and experiment with potential solutions while striving to arrive to a solution formula. It furthermore addresses issues related to solution optimization.