\documentclass[12pt]{article} \usepackage{comment} \usepackage{amsmath} \usepackage{amssymb} % for \nmid \newcommand{\D}{{\mathbb D}} \newcommand{\G}{{\mathbb G}} \newcommand{\Z}{{\mathbb Z}} \newcommand{\N}{{\mathbb N}} \newcommand{\Q}{{\mathbb Q}} \newcommand{\R}{{\mathbb R}} \newcommand{\succc}{{\rm succ}} \newcommand{\pred}{{\rm pred}} \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} \begin{document} \centerline{Homework 05, MORALLY Due March 03} \newif{\ifshowsoln} \showsolntrue % comment out to NOT show solution inside \ifshowsoln and \fi blocks. \begin{enumerate} \item (40 points) For this problem FIRST write the program and make conjectures THEN look up whats true. A prime $p$ such that $p$ and $\frac{p-1}{2}$ are both prime is called a {\it safe prime} \begin{enumerate} \item (0 points) Write a program that will, given a number $n$, test if $n$ is prime, using the naive algorithm of testing if $2,3,4,\ldots,\ceil{\sqrt{n}}$ divides $n$. (Do not hand anything in.) \item (0 points) Write a program that will, given a number $n$, test if both $n$ and $\frac{n-1}{2}$ are prime (use the program in Part 1). (Do not hand anything in.) \item (4 points) Find the following numbers \begin{itemize} \item The number of primes in $\{1,\ldots,10000\}$. The number of safe primes. \item The number of primes in $\{1,\ldots,20000\}$. The number of safe primes. \item $\vdots$ \item The number of primes in $\{1,\ldots,200000\}$. The number of safe primes. \end{itemize} Hand in a table of the following form--- we give the first two lines and they are likely incorrect. \begin{tabular}{|c|c|c|} \hline $n$ & Numb of Primes in $\{1,\ldots,n\}$ & Numb of Safe Primes in $\{1,\ldots,n\}$\cr \hline 10,000 & 100 & 10 \cr 20,000 & 200 & 20 \cr \hline \end{tabular} \item (8 points) It is known that the number of primes $\le n$ is ROUGHLY $\frac{n}{\ln n}$. Using your data make a conjecture about what the value of $A$ is such that the number of primes is around $\frac{An}{\ln n}$. \item (8 points) Find some function $f$ so that the following statement fits your data pretty well: {\it The number of safe primes $\le n$ is roughly $f(n)$ } \vfill \centerline{\bf GO TO NEXT PAGE FOR THE REST OF THIS PROBLEM} \newpage \item (0 points) Write a program that will, given $p$, $g$, a) Test if $p$ is a safe prime. If not then output NO. b) ($p$ is a safe prime) Test if $g$ is a generator (see slides). (Do not hand anything in) \item (4 points) Find the first 20 safe primes after 100,000. Call them $p_1,\ldots,p_{20}$. Hand them in. \item (8 points) Hand in a table of the following form documenting the first 20 safe primes. We give the first two lines. We assume the first two safe primes over 100,000 are 100,001 and 100,003 (this might not be true). \begin{tabular}{|c|c|c|} \hline $p$ & Numb of generators in $\{1,\ldots,p\}$ & fraction that are gen \cr \hline 100,001 & 20,000 & 0.199\cr 100,003 & 21,000 & 0.210\cr \hline \end{tabular} \item (8 points) Based on your data make a conjecture of the following form: For large safe primes $p$, the number of generators in $\{1,\ldots,p\}$ is $\alpha p$ where $\alpha$ is FILL IT IN \end{enumerate} \vfill \centerline{\bf GO TO NEXT PAGE} \newpage \item (30 points) This problem has six parts. However, the first three are worth 0. Do them but don't hand them in. They are a review of what we did in class briefly. \begin{enumerate} \item (0 points---Do not hand in) Compute the following mod 8: $0^2, 1^2,\ldots, 7^2$. \item (0 points---Do not hand in) Use Part 1 to find {\bf all} sums of 3 squares mod 8. \item (0 points---Do not hand in) Use Part 2 to prove that there are an infinite number of natural numbers that cannot be written as the sum of 3 squares. \item (10 points) Compute the following mod 16: $0^4, 1^4,\ldots, 15^4$. \item (10 points) Use Part 4 to find {\bf all} sums of 15 fourth powers mod 16. \item (10 points) Use Part 5 to prove that there are an infinite number of natural numbers that {\bf cannot} be written as the sum of 15 fourth powers. \end{enumerate} \vfill \centerline{\bf GO TO NEXT PAGE} \newpage \item (30 points) \begin{enumerate} \item (15 points) Find a set $\D\subseteq\R$ such that the following all hold: \begin{itemize} \item Every element $x\in \D$ has both a successor element $\succc(x)$ (so $x<\succc(x)$ and there is nothing strictly between $x$ and $\succc(x)$) and a predecessor element $\pred(x)$ (so $\pred(x)