{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "![alt text](https://github.com/callysto/callysto-sample-notebooks/blob/master/notebooks/images/Callysto_Notebook-Banner_Top_06.06.18.jpg?raw=true)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Here's a mystery sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, X, Y\n", "### Based on this pattern, see if you can you figure out the next two terms: X and Y." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def f(n):\n", " if n <= 2: return 1\n", " else: return f(n-1)+f(n-2)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]\n" ] } ], "source": [ "print([f(1),f(2),f(3),f(4),f(5),f(6),f(7),f(8),f(9),f(10),f(11),f(12),f(13),f(14),f(15)])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[5, 55, 610, 6765, 75025]\n" ] } ], "source": [ "print([f(5),f(10),f(15),f(20),f(25)])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Counting Routes Problem\n", "## Let's count the number of routes from the bottom-left square to the top-right square\n", "### Solve this problem for both the 4x4 board and the 5x5 board" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "