# Assignment #4

Examples:
Figure out what the following commands do.

> out:=0;
for a from 0 to 30 do
for b from 0 to 30 do
for c from 0 to 30 do
if a+b+c=30 then out:=out+1; fi;
od; od; od;
> out:=[];
for a from 0 to 3 do
for b from 0 to 3 do
for c from 0 to 3 do
if a+b+c=3 then out:=[op(out),[a,b,c]]; fi;
od; od; od;
> with(plots):
> pointplot({[0,1],[1,-1],[3,0],[4,-3]},axes=boxed,view=[-5..5,-5..5]);
> implicitplot( y^2 - x^3 + x, x = -5..5 , y=-5..5);
> implicitplot( y^2 - x^3 + x, x = -5..5 , y=-5..5, gridrefine=2);
> implicitplot( y^2 - x^3 - x+1, x = -5..5 , y=-5..5);

Question #1:
Say that I asked you to find out how many integer solutions are there to the equation $x_1 + x_2 + x_3 + x_4 = n$ with $x_i \geq 0$ with $x_2+x_3$ is divisible by $3$. Since you don't know $n$, you can't really get an answer immediately, but you might be able to look at the sequence of answers for $n=1,2,3,4,\ldots$ and then guess at a solution and then perhaps prove it. You can also use the online integer sequence database (OEIS) and conjecture or verify that your answer is one that is already in the database. Find out how many solutions there are to this equation satisfying these conditions for $n$ from 1 to 15. Enter this sequence into the OEIS and report back what you find.

Question #2:
An elliptic curve is an equation of the form $y^2 = x^3 + ax + b$ where $a, b$ are real numbers. You can graph an elliptic curve once you know $a$ and $b$ in Maple with the command implicitplot after you enter the command with(plots);. Today we are going to consider "elliptic curves over a finite field," that is we are looking for the solutions to the equations $y^2 \mod p = x^3 + a x + b \mod p$ where $a$ and $b$ and $x$ and $y$ are integers between in the set $\{0,1,2,\ldots,p-1\}$.

I want to know how many and where are the solutions for an example curve that I can change. That is, let $f_{a,b}(x,y) := y^2 - x^3 - a x -b~\mod p$ and for a given $a$ and $b$ and $p$, I want the list of all points $[x,y] \in \{0,1,2,\ldots, p-1\} \times \{0,1,2,\ldots, p-1\}$ such that $f_{a,b}(x,y) = 0$ and then I would like you to graph those points on the integer grid using the command pointplot. In your solution I want to be able to change the equation and change the prime $p$, but for example you should be able to produce pictures like the ones on this website and on the wikipedia page. Call the function you are finding the solutions to fab and make it easy for me to change this expression as well as p.

We will come back to this example later in the term after when we practice with functions because the set of solutions to this equation forms a group under an operation called "addition" where the operation is defined by connecting points on the curve.

You should open up a new worksheet and start from scratch. You will have to save your work in a file and upload that file on to the course moodle. Your solution should be a sequence of commands where it is easy to change the input string and after you execute the sequence of commands you should have the correct output string. Please add documentation to your worksheet to explain how it works. Just a few sentences is sufficient, but imagine that you were opening up the worksheet for the first time and wanted to know what it did.

You should finish your assignment before class Monday October 1 by 11:59pm. Assignments submitted after this date will be assessed a penalty of 10% per day. Additional penalties will apply for not documenting the results of your findings.