\documentclass[12pt]{article} \usepackage{comment} \begin{document} \centerline{\bf Homework 6, MORALLY Due March 11} \newcommand{\st}{\mathrel{:}} \newcommand{\es}{\emptyset} \newcommand{\implies}{\Rightarrow} \newcommand{\goes}{\Rightarrow} \newcommand{\NSQ}{{\rm NSQ}} \newcommand{\GREEDY}{{\rm GREEDY}} \newcommand{\OPTIMAL}{{\rm OPTIMAL}} \newcommand{\OPT}{{\rm OPT}} \newcommand{\into}{{\rightarrow}} \newcommand{\lf}{\left\lfloor} \newcommand{\rf}{\right\rfloor} \newcommand{\lc}{\left\lceil} \newcommand{\rc}{\right\rceil} \newcommand{\Ceil}[1]{\left\lceil {#1}\right\rceil} \newcommand{\ceil}[1]{\left\lceil {#1}\right\rceil} \newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} \newcommand{\Z}{{\sf Z}} \newcommand{\N}{{\sf N}} \newcommand{\Q}{{\sf Q}} \newcommand{\R}{{\sf R}} \newcommand{\D}{{\sf D}} \newcommand{\Rpos}{{\sf R}^+} \begin{enumerate} \item (50 points) In this program we will look at primes of the form $x^2+5y^2$. Send your code to Emily, so that if you get wrong answers, I can give you partial credit. \begin{enumerate} \item (0 points but you will need this later) Write a program that will, given $p$, determines if there exists $x,y$ such that $$p=x^2+5y^2.$$ \item (30 points) For all primes $p\in \N$ such that are $7\le p \le 1000$ run the above program. Produce a table of primes $p\in\N$, such that $7\le p \le 1000$, of the following form. You must put the table in your pdf. You can either copy and paste it into your latex doc, or take a screenshot. \[ \begin{array}{|c|c|c|} \hline p & \hbox{sum of $x^2 + 5y^2$?} & \hbox{$x^2 + 5y^2$} \cr \hline 7 & N & \cr 11 & N & \cr 13 & N & \cr 17 & N & \cr 19 & N & \cr 23 & N & \cr 29 & Y & 3^2 + 5\times 2^2 \cr \hline \end{array} \] \item (20 points) Give a conjecture of the following form: {\it Let $p$ be an odd prime such that $p\ge 7$. Then $p$ is a sum of the form $x^2 + 5y^2$ iff BLANK. } \end{enumerate} \begin{comment} \item (20 points) Let $\pi(n)$ be the number of primes $p$ such that $7\le p \le n$. Let $FIVESQ(n)$ be the number of primes $p$ such that $7\le p\le n$ that can be written in the form $x^2 + 5y^2$. Write a program that, given $n$, determines $\pi(n)$, $FIVESQ(n)$, and $\frac{FIVESQ(n)}{\pi(n)}$. Using this program draw a graph of the function $n$ goes to $\frac{FIVESQ(n)}{\pi(n)}$. Speculate: is it constant? Approaching 0? Approaching 1? something else? \end{comment} \newpage \item (50 points) On the untimed midterm1 you wrote two programs to find, given $n$, a way to write $n$ as a sum of squares. The first one we call GREEDY the second one we call OPTIMAL. \begin{enumerate} \item (0 points but you need to do this for a later part) Let $f(n)$ be $$\max\{\GREEDY(1), \GREEDY(2), \cdots, \GREEDY(n)\}.$$ Write a program that, given $n$, computes $$f(1), \ldots, f(n).$$ \item (0 points but you need to do it for the later parts) Run this program on $n=1000$. \item (20 points) Make a conjecture about what $f(n)$ looks like. (For example: $f(n)$ is ROUGHLY $\sqrt{n}$.) \item (15 points) Let $X_1= \{ n \st n\equiv 7 \pmod 8\}$. On the untimed midterm1, problem 1g, you probably found that, from your data, $$n\in X_1\goes \OPTIMAL(n)=4.$$ Find an infinite set $X_2$ such that $X_1\cap X_2=\es$ and, according to your data, $$n\in X_2\goes \OPTIMAL(n)=4.$$ \item (15 points) Make a conjecture about exactly which numbers $n$ have $\OPTIMAL(n)=4$. \end{enumerate} \end{enumerate} \end{document}