{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\"drawing\"\n", "

Experimental Mathematics Using SageMath — AIMS-ZA-2024-25

\n", "\n", "\n", "## Instructors: \n", "\n", "* **Evans Ocansey**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Day 11 — Positive Divisors\n", "\n", "[comment]: <> (

Day 02 — Introduction to SageMath: A Mathematics Software for All

)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The outline of the this notebook is as follows:\n", "\n", "## Table of Contents: \n", "* [ ] [Investigating Arithmetic Functions](#investigating-arithmetic-functions)\n", "* [ ] [Arithmetic Functions](#arithmetic-functions)\n", " * [Multiplicative Functions](#multiplicative-functions)\n", " * [Completely Multiplicative Functions](#completely-multiplicative-functions)\n", "* [ ] [Multiplicative Properties of $\\tau$ and $\\sigma$](#multiplicative-properties-of-tau-and-sigma)\n", "* [ ] [Exploring $\\tau$ and $\\sigma$ in Sage](#exploring-tau-and-sigma-in-sage)\n", "* [ ] [Questions to Explore](#questions-to-explore)\n", " * [Exploring Question 1](#exploring-question-1)\n", " * [Exploring Question 2](#exploring-question-2)\n", " * [Exploring Question 3](#exploring-question-3)\n", " * [Exploring Question 4](#exploring-question-4)\n", " * [Exploring Question 5](#exploring-question-5)\n", " * [Exploring Question 6](#exploring-question-6)\n", " * [Exploring Question 7](#exploring-question-7)\n", " * [Exploring Question 8](#exploring-question-8)\n", " * [Exploring Question 9](#exploring-question-9)\n", " * [Exploring Question 10](#exploring-question-10)\n", " * [Exploring Question 11](#exploring-question-11)\n", " * [Exploring Question 12](#exploring-question-12)\n", " * [Exploring Question 13](#exploring-question-13)\n", " * [Exploring Question 14](#exploring-question-14)\n", " * [Exploring Question 15](#exploring-question-15)\n", " * [Exploring Question 16](#exploring-question-16)\n", " * [Exploring Question 17](#exploring-question-17)\n", " * [Exploring Question 18](#exploring-question-18)\n", "* [ ] [Conjectures to Explore](#conjectures-to-explore)\n", " * [Exploring Conjecture 1](#exploring-conjecture-1)\n", " * [Exploring Conjecture 2](#exploring-conjecture-2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Investigating Arithmetic Functions \n", "\n", "Today, we will explore the functions $\\tau$ and $\\sigma$, where:\n", "- $\\tau(n)$ counts the number of positive divisors of $n$, and\n", "- $\\sigma(n)$ gives the sum of the positive divisors of $n$.\n", "\n", "Our goal is to use logical reasoning, supported by **SageMath**, to not only make conjectures but also begin proving them." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "2*(35 + 28)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Arithmetic Functions \n", " \n", "**Definition**: An **arithmetic function** is a real or complex-valued function $f$ defined on the set of positive integers:\n", "\n", "$$\n", "f : \\mathbb{Z}_{>0} \\to \\mathbb{C}.\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Multiplicative Functions \n", "\n", "An arithmetic function $ f $ is said to be **multiplicative** if it satisfies the following conditions:\n", "1. $ f $ is not identically zero, and\n", "2. $f(a \\cdot b) = f(a) \\cdot f(b) \\quad \\text{whenever } \\gcd(a, b) = 1. $" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Completely Multiplicative Functions \n", "\n", "An arithmetic function $ f $ is **completely multiplicative** if:\n", "\n", "$$\n", "f(a \\cdot b) = f(a) \\cdot f(b) \\quad \\text{for all } a, b \\in \\mathbb{N}.\n", "$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Multiplicative Properties of $\\tau$ and $\\sigma$\n", "\n", "Are $\\tau$ and $\\sigma$ multiplicative?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### The Case of $\\tau$ \n", "\n", "Let us prove that $\\tau$ is a multiplicative function. To do so, we will consider the following questions:\n", "\n", "1. **Is $\\tau$ an arithmetic function?**\n", " - Yes, $\\tau$ is an arithmetic function. For all $ n \\in \\mathbb{N} $, $ \\tau(n) $ is a natural number. Since $ \\mathbb{N} \\subset \\mathbb{C} $, it follows that $\\tau$ is an arithmetic function.\n", "\n", "2. **For $ a, b \\in \\mathbb{N} $ with $ \\gcd(a, b) = 1 $, is $ \\tau(a \\cdot b) = \\tau(a) \\cdot \\tau(b) $?**\n", " - To prove this, consider:\n", " - The number of divisors of $ a \\cdot b $, where $ \\gcd(a, b) = 1 $.\n", " - Since $ \\gcd(a, b) = 1 $, the divisors of $ a \\cdot b $ are exactly the combinations of the divisors of $ a $ and $ b $. Specifically:\n", " - For a divisor $ a_1 $ of $ a $, the divisors of $ a \\cdot b $ include $ a_1 $ multiplied by each divisor of $ b $.\n", " - The total number of such divisors is $ \\tau(a) \\cdot \\tau(b) $, proving that $ \\tau(a \\cdot b) = \\tau(a) \\cdot \\tau(b) $.\n", "\n", "Thus, $\\tau$ is multiplicative." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### The Case of $\\sigma$ \n", "\n", "Write your proof here." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exploring $\\tau$ and $\\sigma$ in Sage \n", "\n", "How do you define $\\tau$ and $\\sigma$ in Sage?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "divisors(8)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def tau(n):\n", " return len(divisors(n))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def sigma(n):\n", " return sum(divisors(n))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Questions to Explore \n", "\n", "1. What is $\\tau$ and $\\sigma$ of a perfect number?\n", "2. Is the function $\\tau$ also additive, $\\tau(a+b) = \\tau(a) + \\tau(b)$\n", "3. Under what condition is $\\tau(n), \\sigma(n)$ always even or always odd.\n", "4. Is $\\tau(n)$ always a factor of $n$.\n", "5. Can two or more different number have the same $\\sigma(n)$\n", "6. For what values of $n$ is $\\tau(n) = \\sigma(n)$\n", "7. What is the $\\tau(a^n)$ where $n$ is a positive integer?\n", "8. What is the general formula for $\\tau$ and $\\sigma$ for a positive $n$? Provide a proof.\n", "9. Can you write $\\sigma(n)$ as sum of squares or cubes?\n", "10. Can we have the values of $n$ such that $\\tau(n) = n$?\n", "11. Is there a constant for $n$ fixed such that $\\sigma(n) = c \\times \\tau(n)$?\n", "12. For what values of $\\tau(n)$ can we have the square root of $\\sigma(n)$ equal?\n", "13. For what of values of $n$ is $\\tau(n) \\bmod 3 \\equiv 0$?\n", "14. If $n = 2\\,a$ where a is some positive integer, what is relation between $\\tau(n)$ and $\\tau(a)$?\n", "15. If $n$ is odd/even what is $\\tau(n)$ and $\\sigma(n)$?\n", "16. Given $n$ what can we be $\\tau(\\tau(n))$?\n", "17. Can we have an $n$ such $\\tau(n)| \\sigma(n)$?\n", "18. Under what condition $\\sigma(n)-\\tau(n)$ equals to $n$?\n", "19. Given $n$ for what value of $k$ is such that $\\tau^{k}(n)$ returns the same value?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 1 \n", "\n", "What is $\\tau$ and $\\sigma$ of a perfect number." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def is_perfect_number(n: int) -> bool:\n", " if sigma(n) - n == n:\n", " return True\n", " else:\n", " return False\n", "\n", "\n", "def tau_sigma_perfect_number(n_bound: int) -> list:\n", " data = [\n", " [\n", " k,\n", " number_of_divisors(k),\n", " sigma(n=k, k=1),\n", " is_perfect_number(k)\n", " ]\n", " for k in [1..n_bound] if is_perfect_number(k)\n", " ]\n", " return data\n", "\n", "\n", "tau_sigma_perfect_number_data = lambda bound: table(\n", " tau_sigma_perfect_number(n_bound=bound),\n", " header_row = [\n", " r\"$n$\",\n", " r\"$\\tau(n)$\",\n", " r\"$\\sigma(n)$\",\n", " r\"$[n \\text{ is perfect number}]$\"\n", " ]\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "tau_sigma_perfect_number_data(10000000)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot(sigma, 1, 1000000, k=1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 2 \n", "Is the function $\\tau$ also additive, $\\tau(a+b) = \\tau(a) + \\tau(b)$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 3 \n", "\n", "Under what condition is $\\tau(n), \\sigma(n)$ always even or always odd." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 4 \n", "Is $\\tau(n)$ always a factor of $n$." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 5 \n", "Can two or more different number have the same $\\sigma(n)$?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 6 \n", "For what values of $n$ is $\\tau(n) = \\sigma(n)$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 7 \n", "What is the $\\tau(a^n)$ where n is a positive integer?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 8 \n", "What is the general formula for $\\tau$ and $\\sigma$ for a positive $n$. Provide a proof?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 9 \n", "Can you write $\\sigma(n)$ as sum of squares or cubes? Hint: Sage has a function `sum_of_k_squares` which could useful in exploring this question. Read the documentation to know how to use it." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 10 \n", "Can we have the values of $n$ such that $\\tau(n) = n$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 11 \n", "Is there a constant for $n$ fixed such that $\\sigma(n) = c \\cdot \\tau(n)$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 12 \n", "For what values of $\\tau(n)$ can we have the square root of $\\sigma(n)$ equal?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 13 \n", "For what of values of $n$ is $\\tau(n) \\bmod 3 \\equiv 0$." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 14 \n", "If $n = 2\\,a$ where a is some positive integer, what is relation between $\\tau(n)$ and $\\tau(a)$." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 15 \n", "If $n$ is odd/even what is $\\tau(n)$ and $\\sigma(n)$." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 16 \n", "Given $n$ what can we be $\\tau(\\tau(n))$?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 17 \n", "Can we have an $n$ such $\\tau(n)| \\sigma(n)$." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Question 18 \n", "Under what condition $\\sigma(n)-\\tau(n)$ equals to $n$?" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Conjectures to Explore \n", "\n", "1. If $n$ can be expressed as product of $2$ distinct prime then $\\tau(n)$ is additive and $\\sigma(n)$ is even." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Conjecture 1 \n", "\n", "If $p$ is prime then $\\tau(p) = 2$, $\\sigma(p) = p+1$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Exploring Conjecture 2 " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 10.4", "language": "sage", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.2" } }, "nbformat": 4, "nbformat_minor": 4 }