{
"nbformat_minor": 2,
"nbformat": 4,
"cells": [
{
"source": [
"$$\n",
"\\def\\CC{\\bf C}\n",
"\\def\\QQ{\\bf Q}\n",
"\\def\\RR{\\bf R}\n",
"\\def\\ZZ{\\bf Z}\n",
"\\def\\NN{\\bf N}\n",
"$$\n",
"# First Manipulations\n",
"\n",
"Authors \n",
"- Thierry Monteil\n",
"\n",
"License \n",
"CC BY-NC-SA 3.0\n",
"\n",
"## Getting Help\n",
"\n",
"Do not try to be smart, just use existing tools.\n",
"\n",
"### Autocompletion\n",
"\n",
"A *partition* of a nonnegative integer $n$ is a non-increasing list of positive integers with total sum $n$.\n",
"\n",
"Does Sage have a command for defining a partition ?"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"(Hint: type `Part` and then hit the `` key)\n",
"\n",
"### Documentation\n",
"\n",
"Create the partition with list $[4, 3, 1, 1]$ and assign it to the Python name `p` :"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"(Hint: to see documentation and examples for the Permutation command, type `Partition?`)\n",
"\n",
"### Autocompletion for methods\n",
"\n",
"Find the conjugate of `p` (and name it `q`):"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"Which of `p` and `q` dominates the other ?"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"(Hint: to see the methods available to the partition named `p`, you can type `p.` and hit ``)\n",
"\n",
"### Access to the source code\n",
"\n",
"How did Sage decide whether `p` dominates `q` ?"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"## Project Euler\n",
"\n",
"See \n",
"\n",
"> Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems. The problems range in difficulty and for many the experience is inductive chain learning. That is, by solving one problem it will expose you to a new concept that allows you to undertake a previously inaccessible problem. So the determined participant will slowly but surely work his/her way through every problem.\n",
"\n",
"Let us pick two of the first problems, and see how Sage can help to solve them.\n",
"\n",
"### Problem 3\n",
"\n",
"The prime factors of 13195 are 5, 7, 13 and 29.\n",
"\n",
"What is the largest prime factor of the number 600851475143 ?"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"### Problem 5\n",
"\n",
"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.\n",
"\n",
"What is the smallest positive number that is divisible by all of the numbers from 1 to 20?"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"### Problem 78\n",
"\n",
"Let $p(n)$ represent the number of different ways in which $n$ coins can be separated into piles. For example, five coins can be separated into piles in exactly seven different ways, so $p(5)=7$ :"
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"*****\n",
"**** *\n",
"*** **\n",
"*** * *\n",
"** ** *\n",
"** * * *\n",
"* * * *"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"Find the least value of n for which p(n) is divisible by one million."
],
"cell_type": "markdown",
"metadata": {}
},
{
"execution_count": null,
"cell_type": "code",
"source": [
"# edit here"
],
"outputs": [],
"metadata": {}
},
{
"source": [
"### One-liners\n",
"\n",
"The `projecteuler_one-liners` worksheets let you solve the first 10 Project Euler problems in one line thanks to Sage features, without having to reinvent the wheel !\n",
"\n",
"### Account\n",
"\n",
"You can, if you want, create an account on Project Euler. If you solve a problem, visit the Project Euler website and enter your answer. If it is correct, you will be able to join the forum related to this problem. You will be able to read the other solutions, and learn from them."
],
"cell_type": "markdown",
"metadata": {}
}
],
"metadata": {
"kernelspec": {
"display_name": "sagemath",
"name": "sagemath"
}
}
}