\documentclass[12pt,reqno]{article} \usepackage[usenames]{color} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsthm} \usepackage{amsfonts} \usepackage{amscd} \usepackage{graphicx} \usepackage[colorlinks=true, linkcolor=webgreen, filecolor=webbrown, citecolor=webgreen]{hyperref} \definecolor{webgreen}{rgb}{0,.5,0} \definecolor{webbrown}{rgb}{.6,0,0} \usepackage{color} \usepackage{fullpage} \usepackage{float} \usepackage{psfig} \usepackage{graphics} \usepackage{latexsym} \usepackage{epsf} \usepackage{breakurl} \setlength{\textwidth}{6.5in} \setlength{\oddsidemargin}{.1in} \setlength{\evensidemargin}{.1in} \setlength{\topmargin}{-.1in} \setlength{\textheight}{8.4in} \newcommand{\seqnum}[1]{\href{https://oeis.org/#1}{\underline{#1}}} \begin{document} \begin{center} \epsfxsize=4in \leavevmode\epsffile{logo129.eps} \end{center} \theoremstyle{plain} \newtheorem{theorem}{Theorem} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{conjecture}[theorem]{Conjecture} \theoremstyle{remark} \newtheorem{remark}[theorem]{Remark} \begin{center} \vskip 1cm{\LARGE\bf Counting Integers Representable as Images\\ \vskip .1in of Polynomials Modulo $n$} \vskip 1cm \large Fabi\'an Arias\\ Facultad de Ciencias B\'asicas\\ Universidad Tecnol\'ogica de Bol\'ivar\\ Colombia\\ \href{mailto:farias@utb.edu.co}{\tt farias@utb.edu.co}\\ \ \\ Jerson Borja and Luis Rubio \\ Departamento de Matem\'aticas y Estad\'istica\\ Universidad de C\'ordoba\\ Colombia\\ \href{mailto:jersonborjas@correo.unicordoba.edu.co}{\tt jersonborjas@correo.unicordoba.edu.co}\\ \href{mailto:lrubiohernandez@correo.unicordoba.edu.co}{\tt lrubiohernandez@correo.unicordoba.edu.co} \end{center} \vskip .2 in \begin{abstract} Given a polynomial $f(x_1,x_2,\ldots, x_t)$ in $t$ variables with integer coefficients and a positive integer $n$, let $\alpha(n)$ be the number of integers $0\leq a k+1$. \end{lemma} \begin{proof} If $b\in N_{p^n}$, then $b\in A_{p^n}(p^{n-1})$ and thus, $b=c+jp^{n-1}$ for some $c\in A_{p^{n-1}}$ and $0\leq jk+1$, then $n-1\geq 2s+1$. Therefore, if some $m_i$ is not divisible by $p$, then by Lemma \ref{lma+jp^n}, $b=c+jp^{n-1}\in A_{p^n}$, a contradiction. It follows that all the $m_i$ are divisible by $p$. Since $n-1>k$, we have $p^k$ divides $c$ and we get the congruence $c_1(m_1/p)^k+\cdots+c_t(m_t/p)^k\equiv c/p^k\ (\mathrm{mod}\ p^{n-k-1})$. Hence $c/p^k\in A_{p^{n-k-1}}$. We claim that $c/p^k+jp^{n-k-1}\in N_{p^{n-k}}$. On the contrary, if $c_1q_1^k+\cdots+c_tq_t^k\equiv c/p^k+jp^{n-k-1}\ (\mathrm{mod}\ p^{n-k})$ for some integers $q_1,\ldots,q_t$, then by multiplying by $p^k$ we obtain that $c_1(pq_1)^k+\cdots+c_t(pq_t)^k\equiv c+jp^{n-1}\ (\mathrm{mod}\ p^{n})$, that is, $b=c+jp^{n-1}\in A_{p^n}$, a contradiction. Thus, if $a:=c/p^k+jp^{n-k-1}$, then $a\in N_{p^{n-k}}$ and $b=c+jp^{n-1}=p^ka$. This ends the proof. \end{proof} We now define a condition on the prime $p$ and the polynomial, in such a way that the reverse inclusion in Lemma \ref{lmN-sets} holds. Most of the cases we are interested in satisfy this condition. When this condition fails, we must find another way to tackle the problem of finding $\alpha(p^n)$ for $n\geq 1$. Let $p$ be a prime and $f(x_1,\ldots,x_t)$ be any polynomial with coefficients in $\mathbb Z$. We say that a non-negative integer $e$ is an \emph{exponent of $p$ in $f(x_1,\ldots,x_t)$,} if whenever $p^e$ divides an integer of the form $f(m_1,\ldots,m_t)$, then the quotient $f(m_1,\ldots,m_t)/p^e$ is also of the form $f(q_1,\ldots,q_t)$ for some integers $q_1,\ldots, q_t$. \begin{lemma}\label{lmexponent} The following statements are true. \begin{enumerate} \item For every prime number $p$ and $k\geq 1$, $k$ is an exponent of $p$ in $x^k$. \item If $p=2$ or $p$ is prime with $p\equiv 1\ (\mathrm{mod}\ 4)$, then 1 is an exponent of $p$ in the polynomial $x^2+y^2$. \item If $p$ is prime and $p\equiv 3\ (\mathrm{mod}\ 4)$, then 2 is an exponent of $p$ in the polynomial $x^2+y^2$. \item The integer 2 is an exponent of the prime number 2 in the polynomial $x^2+y^2+z^2$. \end{enumerate} \end{lemma} \begin{proof} $(1)$ If $p^k$ divides $m^k$, then $p$ divides $m$ and $m^k/p^k=(m/p)^k$. $(2)$ If $p$ divides an integer of the form $x^2+y^2$, then $(x^2+y^2)/p$ is a sum of two squares by Theorem \ref{teosumsquares}. $(3)$ If $p\equiv 3\ (\mathrm{mod}\ 4)$ divides an integer of the form $x^2+y^2$, then $(x^2+y^2)/p^2$ is a sum of two squares by Theorem \ref{teosumsquares}. $(4)$ Suppose 4 divides $m_1^2+m_2^2+m_3^2$ for integers $m_1, m_2$ and $m_3$. Then $m_1^2+m_2^2+m_3^2$ is even, which implies that two out of the three integers $m_1, m_2$ and $m_3$ are odd and one is even, or the three, $m_1, m_2$ and $m_3$ are even. In the first case, say $m_1=2w_1+1, m_2=2w_2+1$ and $m_3=2w_3$. Then, we have $m_1^2+m_2^2+m_3^2=4(w_1^2+w_2^2+w_1+w_2+w_3^2)+2$, which is not divisible by 4. Hence, $m_1, m_2$ and $m_3$ are even. So, we can write $m_1=2w_1, m_2=2w_2, m_3=2w_3$ and, therefore, $m_1^2+m_2^2+m_3^2=4(w_1^2+w_2^2+w_3^2)$. This ends the proof. \end{proof} Note that if $e$ is an exponent of a prime $p$ in a polynomial $f(x_1,x_2,\ldots, x_t)$, then any positive multiple of $e$ is also an exponent of $p$ in $f(x_1,x_2,\ldots, x_t)$. \begin{lemma}\label{lmN-sets2} If an exponent $e$ of a prime $p$ in the polynomial $c_1x_1^k+\cdots+c_tx_t^k$ divides $k$, then $\{p^ka:a\in N_{p^{n-k}}\}\subseteq N_{p^n}$ for $n>k$. \end{lemma} \begin{proof} If $p^ka\in A_{p^n}$ where $a\in N_{p^{n-k}}$, then there are integers $m_1,\ldots,m_t$ such that $c_1m_1^k+\cdots+c_tm_t^k\equiv p^ka\ (\mathrm{mod}\ p^{n})$. Since $e$ divides $k$, we have $k$ is an exponent of $p$ in $c_1x_1^k+\cdots+c_tx_t^k$. Then, we can write $(c_1m_1^k+\cdots+c_tm_t^k )/p^k=c_1q_1^k+\cdots+c_tq_t^k$ for some integers $q_1,\ldots, q_t$. Therefore, $c_1q_1^k+\cdots+c_tq_t^k\equiv a\ (\mathrm{mod}\ p^{n-k})$, that is, $a\in A_{p^{n-k}}$, a contradiction. Thus, $p^ka\in N_{p^n}$ for all $a\in N_{p^{n-k}}$. \end{proof} An application of Lemma \ref{lmN-sets} and \ref{lmN-sets2} tells us that if there is an exponent of $p$ in $c_1x_1^k+c_2x_2^k+\cdots+c_tx_t^k$ that divides $k$, then for all $n>k+1$ we have \begin{equation} N_{p^n}=\{p^ka: a\in N_{p^{n-k}}\}. \end{equation} For a set of integers $A$, $mA$ denote the set $\{ma:a\in A\}$. Then $N_{p^n}=p^kN_{p^{n-k}}$ for all $n>k+1$. Therefore, if $n=qk+r$, where $2\leq r\leq k+1$, we have \begin{equation}\label{eqN_p^kq} N_{p^n}=p^kN_{p^{n-k}}=p^{2k}N_{p^{n-2k}}=\cdots=p^{kq}N_{p^r}. \end{equation} We set $n_r:=|N_{p^r}|$, for $2\leq r\leq k+1$. By (\ref{eqN_p^kq}), it follows that if $n>1$ and $n\equiv r\ (\mathrm{mod}\ k)$, then $|N_{p^n}|=|N_{p^r}|=n_r$. \begin{proposition}\label{propNsets} Let $p$ be a prime and $k\geq 1$. Suppose that some exponent $e$ of $p$ in the polynomial $c_1x_1^k+\cdots+c_tx_t^k$ divides $k$, and $p$ does not divide $c_1, \ldots, c_t$. Then \begin{equation}\label{eqrecurrencealphan_r} \alpha(p^n)=p\alpha(p^{n-1})-n_r \end{equation} for all $n>1$ such that $n\equiv r\ (\mathrm{mod}\ k)$. \end{proposition} \begin{proof} The result follows from the fact that $|N_{p^n}|=|N_{p^r}|=n_r$ and Lemma \ref{lmrecurrence}. \end{proof} It is not difficult to deduce, from (\ref{eqrecurrencealphan_r}), the following explicit formulas for $\alpha(p^n)$. \begin{corollary}\label{corexplicit} Let $p$ be a prime and $k$ be a positive integer. Suppose that some exponent $e$ of $p$ in the polynomial $c_1x_1^k+\cdots+c_tx_t^k$ divides $k$, and $p$ does not divide $c_1, \ldots, c_t$. Let $n$ be a positive integer. \begin{enumerate} \item[$(i)$] If $n\equiv 1\ (\mathrm{mod}\ k)$, then \begin{equation*} \alpha(p^n)=p^{n-1}\alpha(p)-\frac{p^{n-1}-1}{p^k-1}\sum_{j=2}^{k+1}n_jp^{k-j+1}; \end{equation*} \item[$(ii)$] If $n\equiv r\ (\mathrm{mod}\ k)$ where $2\leq r\leq k$, then \begin{equation*} \alpha(p^n)=p^{n-1}\alpha(p)-\frac{p^{n-1}-p^{r-1}}{p^k-1}\sum_{j=2}^{k+1}n_jp^{k-j+1}-\sum_{j=2}^{r}n_jp^{r-j}. \end{equation*} \end{enumerate} \end{corollary} For the sets $N_{p^r}$ with $2\leq r\leq k+1$, we have the following result. \begin{proposition}\label{propNsetsn<=k+1} Consider the $N$-sets associated with the polynomial $c_1x_1^k+c_2x_2^k+\cdots+c_tx_t^k$. Let $p$ be a prime number that does not divide $c_1,\ldots, c_t$ and let $p^s$ be the highest power of $p$ that divides $k$. If $2s+2\leq r\leq k+1$, then \begin{equation*} N_{p^{r}}\subseteq \{jp^{r-1}:0 s$.}\\ \end{cases} \end{equation*} See, for example, \cite[Chapter 4, Sec. 2]{ireland}. So, we can write \begin{equation*} \alpha(p^n)=1+\sum_{0\leq r< \lceil\frac{n-s-1}{k}\rceil}p^{n-rk-s-1}(p-1)+\sum_{\lceil\frac{n-s-1}{k}\rceil\leq r\leq \lfloor\frac{n}{k}\rfloor}(p-1). \end{equation*} \end{remark} \section{Sums and differences of squares} In this section we apply our ideas to the polynomials $x^2+y^2, x^2+y^2+z^2$ and $x^2-y^2$. In each case, we determine formulas for $\alpha(p^n)$. We also show how to determine explicitly the sets $A_{p^n}$ and answer the question about determining all $n$ such that the given polynomial is surjective on $n$. \subsection{The polynomial \texorpdfstring{$x^2+y^2$}{Lg}} We consider the polynomial $f(x,y)=x^2+y^2$ and its associated function $\alpha$. By using our method, we obtain the results about the size of the sets $A_{p^n}$ found in \cite{burns, harrington}. \begin{lemma}\label{lmalpha(p)=p} For any prime number $p$, we have $\alpha(p)=p$. \end{lemma} \begin{proof} Let us show that every element in $I_p=\{0,1,\ldots,p-1\}$ is expressible as the sum of two squares modulo $p$. It is known that there are $(p+1)/2$ elements in $I_p$ that are squares modulo $p$. Then, for a given $a\in I_p$, there are $(p+1)/2$ elements in $I_p$ that are expressible as $a-x^2$ modulo $p$. Since $2(p+1)/2=p+1$ and $I_p$ has $p$ elements, there is an element in $I_p$ that is expressible simultaneously as $a-x^2$ and $y^2$ modulo $p$, for some $x, y\in I_p$. This implies that $x^2+y^2\equiv a\ (\mathrm{mod}\ p)$. \end{proof} We now calculate $\alpha(2^n)$ for all $n\geq 1$. By Lemma \ref{lmexponent}, the prime 2 has exponent 1 in $x^2+y^2$. An easy computation gives us the following: \[ A_{2}=\{0,1\},\ A_{4}=\{0,1,2\},\ A_{8}=\{0,1,2,4,5\}. \] and \[ A_{4}(2)=\{0,1,2,3\},\ A_{8}(4)=\{0,1,2,4,5,6\}. \] Then, $N_4=\{3\}$ and $N_8=\{6\}$, that is, $n_2=1$ and $n_3=1$. Now, by applying Corollary \ref{corexplicit}, for $n$ odd we have \begin{align*} \alpha(2^n)&=2^{n-1}\alpha(2)-\frac{2^{n-1}-1}{2^2-1}(2+1)\\ &=2^n-(2^{n-1}-1)\\ &=2^{n-1}+1, \end{align*} and for $n$ even \begin{align*} \alpha(2^n)&=2^{n-1}\alpha(2)-\frac{2^{n-1}-2}{2^2-1}(2+1)-1\\ &=2^n-(2^{n-1}-2)-1\\ &=2^{n-1}+1. \end{align*} Therefore, for all $n\geq 1$\begin{equation*}\label{eqalpha2^n} \alpha(2^n)=2^{n-1}+1. \end{equation*} \begin{remark} By applying our method we obtain explicit descriptions of the sets $A_{2^n}$ for all $n\geq 1$, as follows. First of all, we determine $N_{2^n}$ for all $n\geq 2$. Note that $N_{2^2}=\{3\cdot 2^{2-2}\}$ and $N_{2^3}=\{3\cdot 2^{3-2}\}$. For $n>3$, we can write $n=2q+r$, where $r\in \{2,3\}$. It follows by (\ref{eqN_p^kq}) that $N_{2^n}=\{2^{2q}a:a\in N_{2^r}\}=\{2^{n-r}a:a\in N_{2^r}\}$. Then, it is easy to see that \[N_{2^n}=\{3\cdot 2^{n-2}\}=\{2^{n-2}+2^{n-1}\}\] for all $n\geq 2$. We recall that \begin{align*} A_{2^n}&=\{a+a_{n-1}2^{n-1}: a\in A_{2^{n-1}}, a_{n-1}\in\{0,1\}\}\setminus N_{2^n}. \end{align*} By an induction argument on $n$, it is not difficult to show that for all $n\geq 1$, $A_{2^n}$ consists of all elements of the form \begin{equation}\label{eqbase2} a_0+a_1\cdot 2+a_2\cdot 2^2+\cdots+a_{n-1}\cdot 2^{n-1} \end{equation} where \begin{enumerate} \item $a_0, a_1, a_2, \ldots, a_{n-1}\in \{0,1\}$, \item $a_0+a_1\cdot 2+a_2\cdot 2^2+\cdots+a_{i-1}\cdot 2^{i-1}\in A_{2^i}$, $i=1,\ldots, n-1$. \end{enumerate} Now, assume that an element of the form (\ref{eqbase2}) is not in $A_{2^n}$. Then there is some $i$, $2\leq i\leq n$, such that $a_0+a_1\cdot 2+a_2\cdot 2^2+\cdots+a_{i-1}\cdot 2^{i-1}\in N_{2^i}$. Since $N_{2^i}=\{2^{i-2}+2^{i-1}\}$, we see that $a_0=\cdots=a_{i-3}=0$ and $a_{i-2}=a_{i-1}=1$. So, \[a_0+a_1\cdot 2+a_2\cdot 2^2+\cdots+a_{n-1}\cdot 2^{n-1}=2^{i-2}+2^{i-1}+a_{i}2^i+\cdots+a_{n-1}2^{n-1}.\] Conversely, all elements of the form $2^{i-2}+2^{i-1}+a_{i}2^i+\cdots+a_{n-1}2^{n-1}$, where $a_i, \ldots, a_{n-1}\in \{0,1\}$ are not in $A_{2^n}$. Therefore, $A_{2^n}$ is the set of all integers of the form (\ref{eqbase2}) such that the first two nonzero coefficients are not consecutive. With this description of $A_{2^n}$, we can also calculate $\alpha(2^n)$. In fact, there are $2^{n-i-2}$ elements of the form $2^{i-2}+2^{i-1}+a_{i}2^i+\cdots+a_{n-1}2^{n-1}$ for $2\leq i\leq n$. So, \[\alpha(2^n)=2^n-\sum_{i=2}^{n}2^{n-i}=2^n-(2^{n-1}-1)=2^{n-1}+1.\] \end{remark} Now, we compute $\alpha(p^n)$ where $p$ is an odd prime. In this case, the highest power of $p$ that divides $2$ is $p^0$, so by Proposition \ref{propNsetsn<=k+1} we have $N_{p^2}\subseteq\{jp:03$, $N_{p^2}=\{jp:01$ is odd;}\\ \{jp^{n-1}:01$.} \end{cases} \] This implies that $\alpha(p^n)=p^n$ for all $n\geq 1$. \end{proof} \subsection{The polynomial \texorpdfstring{$x^2+y^2+z^2$}{Lg}} In this section we consider the polynomial $f(x,y,z)=x^2+y^2+z^2$ and its associated function $\alpha$. By Lemma \ref{lmexponent} we have 2 is an exponent of the prime 2 in $x^2+y^2+z^2$. By direct computations, we check easily that $A_{2}=\{0,1\}$, $A_{4}=\{0,1,2,3\}$, $A_{8}=\{0,1,2,3,4,5,6\}$, and we see that $N_4=\varnothing$ and $N_8=\{7\}$. From Proposition \ref{propNsets}, it follows that \[ \alpha(2^n)=\begin{cases} 2, &\text{if $n=1$;}\\ 2\alpha(2^{n-1}), &\text{if $n$ is even;}\\ 2\alpha(2^{n-1})-1, &\text{if $n>2$ is odd.}\\ \end{cases} \] The corresponding explicit formula is \[\alpha(2^n)= \begin{cases} \frac{1}{3}(5\cdot 2^{n-1}+1), &\text{if $n$ is odd;}\\ \frac{2}{3}(5\cdot 2^{n-2}+1), &\text{if $n$ is even.} \end{cases} \] We now describe explicitly the sets $A_{2^n}$. It is not difficult to show that \[N_{2^n}= \begin{cases} \varnothing,& \text{if $n$ is even;}\\ \{7\cdot 2^{n-3}\},& \text{if $n\geq 2$ is odd.} \end{cases}\] For $n\geq 2$ odd, we have $N_{2^n}=\{2^{n-3}+2^{n-2}+2^{n-1}\}$. So the set $A_{2^n}$ consists of all integers $a_0+a_12+\cdots+a_{n-1}2^{n-1}$ that are not of the form $2^i+2^{i+1}+2^{i+2}+a_{i+3}2^{i+3}+\cdots+a_{n-1}2^{n-1}$ for some odd $i$ with $0\leq i\leq n-3$. \vspace{.3cm} Now, we consider the case where $p$ is an odd prime. We cannot apply Proposition \ref{propNsets} because there is no exponent of $p$ in $x^2+y^2+z^2$, so we treat this case in a slightly different way using Lemma \ref{lmN-sets}. In order to do this, we take into account that odd primes are divided into 4 families depending on their residue modulo 8. The multiplication table of $\{1,3,5,7\}$ modulo 8 is shown in Table \ref{tablemod8}. \begin{table} \begin{center} \begin{tabular}{c|cccc}\label{table} &1&3&5&7\\ \hline 1&1&3&5&7\\ 3&3&1&7&5\\ 5&5&7&1&3\\ 7&7&5&3&1 \end{tabular} \end{center} \caption{Multiplication modulo 8} \label{tablemod8} \end{table} Recall that, by Theorem \ref{teosumthree}, a nonnegative integer is representable as the sum of three squares if and only if it is not of the form $4^a(8b+7)$. From Table \ref{tablemod8}, we can deduce the following facts: \begin{enumerate} \item Dividing a number that is not of the form $4^a(8b+7)$ by a prime of the form $8k+1$, gives a number that is not of the form $4^a(8b+7)$. That is, if $p$ is a prime of the form $8k+1$, then 1 is an exponent of $p$ in $x^2+y^2+z^2$. \item Dividing a number that is not of the form $4^a(8b+7)$ by the square of a prime of the form $8k+3, 8k+5$ or $8k+7$ gives a number that is not of the form $4^a(8b+7)$. Thus, if $p$ is a prime of the form $8k+3, 8k+5$ or $8k+7$, then 2 is an exponent of $p$ in $x^2+y^2+z^2$. \end{enumerate} \begin{lemma}\label{lmpm-cp^2} If $p$ is an odd prime and $m$ is a sum of three squares, then there exists $c\in \mathbb Z$ such that $pm-cp^2$ is the sum of three squares. \end{lemma} \begin{proof} If $pm$ is a sum of three squares, then we can take $c=0$. Suppose that $pm$ is not the sum of three squares. Then one of the following cases holds: \begin{enumerate} \item $p$ is of the form $8k+3$ and $m$ is of the form $4^a(8b+5)$, \item $p$ is of the form $8k+5$ and $m$ is of the form $4^a(8b+3)$, \item $p$ is of the form $8k+7$ and $m$ is of the form $4^a(8b+1)$. \end{enumerate} We will show that in any case, $pm-2p^2$ is not of the form $4^a(8b+7)$. If $a>0$, then $pm-2p^2$ is not divisible by 4, so $pm-2p^2$ is not of the form $4^a(8b+7)$. Therefore, $pm-2p^2$ is a sum of three squares. Now, assume that $a=0$. In case 1 we have $pm-2p^2=(8k+3)(8b+5)-2(8k+3)^2=(8k+3)[8(b-2k-1)+7]$, which is a number of the form $8k+5$ and it is the sum of three squares. In case 2, $pm-2p^2=(8k+5)(8b+3)-2(8k+5)^2=(8k+5)[8(b-2k-1)+1]$, which is a number of the form $8k+5$ and it is also the sum of three squares. In case 3, $pm-2p^2=(8k+7)(8b+1)-2(8k+7)^2=(8k+7)[8(b-2k-2)+3]$, which is a number of the form $8k+5$ and it is the sum of three squares. \end{proof} \begin{proposition} Let $p$ be an odd prime number. Then $\alpha(p^n)=p^n$ for all $n\geq 1$. \end{proposition} \begin{proof} First of all, by Lemma \ref{lmalpha(p)=p}, every element in $I_p=\{0,1,\ldots, p-1\}$ is the sum of two squares modulo $p$ and so, every element in $I_p$ is the sum of three squares. This means that $A_p=\{0,1,\ldots, p-1\}$ and $\alpha(p)=p$. By Proposition \ref{propNsetsn<=k+1}, we have $N_{p^2}\subseteq\{jp:0