\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}{\rm \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 The Number $a^2+b^2-dc^2$ Revisited}
\vskip 1cm
\Large

Nguyen Viet Dung and Luu Ba Thang\\
Department of Mathematics and Informatics \\
Hanoi National University of Education \\
136 Xuan Thuy \\
Cau Giay, Hanoi \\
Vietnam \\
\href{mailto: thanglb@hnue.edu.vn}{\tt thanglb@hnue.edu.vn}\\
\href{mailto: vietdung10122000@gmail.com}{\tt vietdung10122000@gmail.com}
\end{center}

\vskip .2in

\begin{abstract} In 2015, Nowicki  posed the following
question: let $d = q$ or $d = 2q$, where $q$ is a product of prime 
numbers of the form $4k + 1$. Is it true that $d$ is a special number? 
We answer  this open question.
\end{abstract}


\section{Introduction}
A positive integer $d$ is called a {\it special\/} number if for every integer $m$ there exist nonzero integers $a, b, c$ such that $m=a^2+b^2-dc^2$. Nowicki \cite{Now} proved that there are  infinitely many special numbers and every special number is of the form $q$ or $2q$, where either $q = 1$ or $q$ is a
product of prime numbers of the form $4k + 1$. Then he posed the 
following open question: let $d = q$ or $d = 2q$, where $q$ is a product of prime numbers of the form $4k + 1$. Is it true that $d$ is a special number? In this article, we confirm
that the answer is yes.
\begin{theorem}\label{theo1}
Let $d=q$ or $d=2q$, where $q$ is a product of prime numbers of the form $4k+1$. Then $d$ is a special number.
\end{theorem}
\section{Proof of the main result}

First, we  recall some lemmas that we need to prove our results.
\begin{lemma}\cite[p.\ 378]{Sie}\label{lem1}
If an odd prime $p$ divides the sum of the squares of two relatively
prime positive integers, then it must be of the form $4k + 1$.
\end{lemma}
\begin{lemma}\cite[p.\ 227] {Sie}\label{lem2} If $p$ is a prime of the form $4k+1$ then for $s=1,2,\ldots$, the number $p^s$ admits precisely one representation as the sum of the squares of two relatively prime natural numbers.

\end{lemma}
\begin{lemma}\cite[p.\ 228]{Sie}\label{lem3} If $m,n$ are two odd numbers that are relatively prime, and such that each of them is representable as the sum of the squares of two relatively prime positive integers, then the product $mn$ admits at least two representations as the sum of the squares of two relatively prime positive integers that differ not only in the order of the summand.

\end{lemma}
Using the lemmas above, we can obtain the following theorem.
\begin{theorem}\label{theo2}
A positive integer $d>2$ can be written in form of $a^2+b^2$, where $a,b$ are two relatively prime positive integers if and only if $d=q$ or $d=2q$, where $q$ is a product of prime numbers of the form $4k+1$.
\end{theorem}
\begin{proof}
Assume that $d = a^2+b^2$, where $a,b$ are two relatively prime positive
integers. Let $p$ be an odd prime factor of $d$, we have $p|a^2+b^2$. By
Lemma \ref{lem1}, we see that $p$ is a prime of the form $4k+1$.

If $d$ is divisible by $4$ then $4|a^2+b^2$.  This only happens when both $a$ and $b$ are even, which contradicts the fact that $a,b$ are relatively prime. Therefore, $4\nmid d$. So $d=q$ or $d=2q$, where $q$ is a positive integer that all of whose prime factors are of the form $4k+1$.
 
 If $d=q$ or $d=2q$, where $q$ is a product of prime numbers of the form $4k+1$. We have two cases:
    \begin{itemize}
        \item [(i)] $d=q$:  We write $d=q_1^{\alpha_1} q_2^{\alpha_2}\cdots q_t^{\alpha_t}$, where $q_1,q_2,\ldots,q_t$ are distinct primes of form $4k+1$ and $\alpha_j$ are positive integers for all $j=1,2,\ldots, t$. By Lemma  \ref{lem2}, $q_j^{\alpha_j}$ can be written as the sum of the squares of two relatively prime positive integers for all $j=1,2,\ldots, t$.
        By Lemma \ref{lem3} we have $d=q_1^{\alpha_1}q_2^{\alpha_2}\cdots q_t^{\alpha_t}$ can be written as the sum of the squares of two relatively prime positive integers for all $j=1,2,\ldots ,t$. 
        \item[(ii)] $d=2q$. By (i), we have $q=A^2+B^2$, where $A, B$ are positive integers and $\gcd(A,B)=1$. So
        $$d=2q=2(A^2+B^2)
        =(A+B)^2+(A-B)^2. $$
        Since $q$ is odd, we see that $A+B$ and $A-B$ are also odd. 
Combined with $\gcd(A,B)=1$, we deduce that $\gcd(A+B,A-B)=1$.
    \end{itemize}
\end{proof}
Now we answer the open question that we  mentioned in introduction.

\begin{proof}[{\bf Proof of Theorem \ref{theo1}}]
We consider two cases:
\begin{itemize}
    \item [(i)] $d=q$, where $q$ is a product of prime numbers of the form $4k+1$. 
    
    By Theorem \ref{theo2}, we have $d=A^2+B^2$, where $A,B$ are positive integers and $\gcd(A,B)=1$.
    Since $d$ is odd, we deduce that $A+B$ is odd. Without loss of generality, we can consider that $A$ is even and $B$ is odd.
    
    Because $\gcd(A,B)=1$, there exist integers $e,f$ such that  $Ae+Bf=1$.
    Then for all integers $k$ we have
    \begin{equation}\label{eq1}
        A(e+Bk)+B(f-Ak)=1.
    \end{equation}
    Now let $n$ be an arbitrary integer. We consider two cases:
\begin{itemize}  

 \item[(a)] $n$ is even.
 
 Because $B$ is odd, we can choose $k_0\in \mathbb{Z}$ such that $e+Bk_0$ is odd. Therefore  $e+B(k_0+2t)$ is odd for all $t\in \mathbb{Z}$. Now we can easily see that
       
             $$\displaystyle \lim_{t\rightarrow +\infty} \left |n-(e+B(k_0+2t))^2-(f-A(k_0+2t))^2\right |=+\infty;$$
             $$ \displaystyle\lim_{t\rightarrow +\infty}\left |A\cdot \dfrac{n-(e+B(k_0+2t))^2-(f-A(k_0+2t))^2}{2}+e+B(k_0+2t)\right |=+\infty ;$$
             $$\displaystyle\lim_{t\rightarrow +\infty} \left |B\cdot \dfrac{n-(e+B(k_0+2t))^2-(f-A(k_0+2t))^2}{2}+f-A(k_0+2t)\right |=+\infty.$$
        
        So we can choose a large enough positive integer $t_0$  such that  $$n-(e+B(k_0+2t_0))^2-(f-A(k_0+2t_0))^2\neq 0;$$
             $$A\cdot \dfrac{n-(e+B(k_0+2t_0))^2-(f-A(k_0+2t_0))^2}{2}+e+B(k_0+2t_0)\neq 0 ; $$
            $$B\cdot\dfrac{n-(e+B(k_0+2t_0))^2-(f-A(k_0+2t_0))^2}{2}+f-A(k_0+2t_0)\neq 0.$$
    Set $e_1=e+B(k_0+2t_0),f_1=f-A(k_0+2t_0)$ and $l=\dfrac{n-e_1^2-f_1^2}{2}$; then $$l\neq 0, Al+e_1\ne 0, Bl+f_1\ne 0$$ and $e_1$ is odd.
        Combined with (\ref{eq1}), we get $Ae_1+Bf_1=1$. Because $A$ is even, $Ae_1$ is even and so that,  $Bf_1$ is odd. Hence, $f_1$ is odd. Since $e_1$ and $f_1$ are odd, it follows that $e_1^2+f_1^2$ is even. This deduces that  $$l=\dfrac{n-e_1^2-f_1^2}{2}\in \mathbb{Z}.$$  Set $$a=Al+e_1, b=Bl+f_1, c=l;$$ 
then we have
        \begin{displaymath}
          \begin{aligned}
        a^2+b^2-dc^2&=(Al+e_1)^2+(Bl+f_1)^2-dl^2\\&=2(Ae_1+Bf_1)l+e_1^2+f_1^2\\&=2l+e_1^2+f_1^2=n,
         \end{aligned}
        \end{displaymath}
where $a=Al+e_1\ne 0, b=Bl+f_1\ne 0, l\ne 0$.
    
\item[(b)]  $n$ is odd. 

Because $B$ is odd, we can choose $k_1\in \mathbb{Z}$ such that $e+Bk_1$ is even. Then $e+B(k_1+2t)$ is even for all $t\in \mathbb{Z}$. Now we see that
             $$\displaystyle \lim_{t\rightarrow +\infty} \left |n-(e+B(k_1+2t))^2-(f-A(k_1+2t))^2\right |=+\infty;$$
          $$\displaystyle\lim_{t\rightarrow +\infty} \left |A\cdot\dfrac{n-(e+B(k_1+2t))^2-(f-A(k_1+2t))^2}{2}+e+B(k_1+2t)\right |=+\infty;$$
        $$ \displaystyle\lim_{t\rightarrow +\infty} \left |B\cdot\dfrac{n-(e+B(k_1+2t))^2-(f-A(k_1+2t))^2}{2}+f-A(k_1+2t)\right |=+\infty.$$
        
        Therefore, we can choose a large enough positive integer $t_1$ such that  $$n-(e+B(k_1+2t_1))^2-(f-A(k_1+2t_1))^2\neq 0;$$
    $$A\cdot\dfrac{n-(e+B(k_1+2t_1))^2-(f-A(k_1+2t_1))^2}{2}+e+B(k_1+2t_1)\neq 0;$$
    $$ B.\dfrac{n-(e+B(k_1+2t_1))^2-(f-A(k_1+2t_1))^2}{2}+f-A(k_1+2t_1)\neq 0.$$
        
        Set $$e_2=e+B(k_1+2t_1),f_2=f-A(k_1+2t_1)\; \text{and} \; l_1=\dfrac{n-e_2^2-f_2^2}{2};$$
        then  $$l_1\neq 0, Al_1+e_2\ne 0, Bl_1+f_2\ne 0$$ and $e_2$ is even.
        Combined with (\ref{eq1}), we obtain $Ae_2+Bf_2=1$. Because $A$ is even, $Ae_2$ is even and $Bf_2$ is odd. Therefore, $f_2$ is odd. This implies that $e_2^2+f_2^2$ is odd. So $$l_1=\dfrac{n-e_2^2-f_2^2}{2}\in \mathbb{Z}.$$ 
        Set $$a=Al_1+e_2, b=Bl_1+f_2, c=l_1;$$ then we obtain
       \begin{displaymath}
          \begin{aligned}
        a^2+b^2-dc^2&=(Al_1+e_2)^2+(Bl_1+f_2)^2-dl_1^2\\&=2(Ae_2+Bf_2)l_1+e_2^2+f_2^2\\&=2l_1+e_2^2+f_2^2=n,
        \end{aligned}
      \end{displaymath}
        where $a=Al_1+e_2\ne 0, b=Bl_1+f_2\ne 0, l_1\ne 0$.
 \end{itemize}
   
    \item[(ii)] $d=2q$, where $q$ a product of prime numbers of the form $4k+1$. 
    
    By Theorem \ref{theo2} we have $d=C^2+D^2$, where $C,D$ are odd and relatively prime. Now let $n$ be an arbitrary integer. Then we consider two cases:
    \begin{itemize}
        \item [(c)] $n$ is odd.
        
        Because $\gcd(C,D)=1$, there exist integers $g,h$ such that
    $$Cg+Dh=1.$$
        Then for every integer $k$ we have
        \begin{equation}\label{eq2}
                         C(g+Dk)+D(h-Ck)=1.
         \end{equation}
        Because both $C,D$ are odd, we have $(g+Dk)+(h-Ck)$ is odd. 

Hence, $(g+Dk)^2+(h-Ck)^2$ is odd. 
        We see that
         $$\displaystyle\lim_{k\rightarrow +\infty}\left |n-(g+Dk)^2-(h-Ck)^2\right |=+\infty;$$
        $$\displaystyle \lim_{k\rightarrow +\infty} \left |C\cdot\dfrac{n-(g+Dk)^2-(h-Ck)^2}{2}+(g+Dk)\right |=+\infty;$$
        $$\displaystyle \lim_{k\rightarrow +\infty}\left |D\cdot\dfrac{n-(g+Dk)^2-(h-Ck)^2}{2}+(h-Ck)\right |=+\infty.$$
       
        Therefore, we can choose a large enough positive integer $k_2$ such that
         $$n-(g+Dk_2)^2-(h-Ck_2)^2\neq 0;$$
            $$C\cdot \dfrac{n-(g+Dk_2)^2-(h-Ck_2)^2}{2}+(g+Dk_2)\ne 0;$$
        $$D\cdot\dfrac{n-(g+Dk_2)^2-(h-Ck_2)^2}{2}+(h-Ck_2)\ne 0.$$
       
        Set $$g_1=g+Dk_2, h_1=h-Ck_2\; \text{and}\; j=\dfrac{n-g_1^2-h_1^2}{2};$$ then $j\ne 0, Cj+g_1\ne 0, Dj+h_1\ne 0$ and $g_1^2+h_1^2$ is odd.  Because $n$ and $g_1^2+h_1^2$ are odd, it follows that  $j=\dfrac{n-g_1^2-h_1^2}{2}$ is an integer. Set $c=j, a=Cj+g_1, b=Dj+h_1$; then
        \begin{displaymath}
          \begin{aligned}
            a^2+b^2-dc^2&=(Cj+g_1)^2+(Dj+h_1)^2-dj^2\\ &=2(Cg_1+Dh_1)j+g_1^2+h_1^2=n.
        \end{aligned}
       \end{displaymath}
        Notice that $a=Cj+g_1 \ne 0, b=Dj+h_1\ne 0, c=j\ne 0$.
        \item[(d)] $n$ is even.
        
        Because $\gcd(C,D)=1$, there exist integers $g',h'$ such that
        $$Cg'+Dh'=2.$$
        Then for every integer $k$ we have
        \begin{equation}\label{eq3}
            C(g'+Dk)+D(h'-Ck)=2 
        \end{equation}
        Now we consider two small cases of $n$:
        \begin{itemize}
            \item [First case:] $n\equiv 2 \pmod 4$.\\
            Because $C,D$ are odd, we can choose $k_4\in \mathbb{Z}$ such that $g'+Dk_4$ is odd.
            
            From (\ref{eq3}), we have $$C(g'+Dk_4)+D(h'-Ck_4)=2.$$
            Therefore, $h'-Ck_4$ is also odd. Now we see that
             $$\displaystyle \lim_{t\rightarrow +\infty} \left |n-(g'+D(k_4+2t))^2-(h'-C(k_4+2t))^2\right |=+\infty;$$
                $$\displaystyle \lim_{t\rightarrow +\infty}\left |C\cdot\dfrac{n-(g'+D(k_4+2t))^2-(h'-C(k_4+2t))^2}{2}+(g'+D(k_4+2t))\right |=+\infty ;$$
            $$\displaystyle \lim_{t\rightarrow +\infty}\left |D\cdot\dfrac{n-(g'+D(k_4+2t))^2-(h'-C(k_4+2t))^2}{2}+(h'-C(k_4+2t))\right|=+\infty. $$
         
           Therefore, we can choose a large enough positive integer $t_4$  such that
            $$n-(g'+D(k_4+2t_4))^2-(h'-C(k_4+2t_4))^2\neq 0;$$
                $$C\cdot\dfrac{n-(g'+D(k_4+2t_4))^2-(h'-C(k_4+2t_4))^2}{2}+(g'+D(k_4+2t_4))\neq 0;$$
             $$D\cdot\dfrac{n-(g'+D(k_4+2t_4))^2-(h'-C(k_4+2t_4))^2}{2}+(h'-C(k_4+2t_4))\neq 0.$$
           
            Set $g_2=g'+D(k_4+2t_4), h_2=h'-C(k_4+2t_4), y=\dfrac{n-g_2^2-h_2^2}{4}$; then  $$y\ne 0, Cy+g_2\ne 0, Dy+h_2\ne 0 $$ and $g_2,h_2$ are odd.
            Because $g_2,h_2$ are odd, we have $g_2^2+h_2^2\equiv n \pmod 4$ and so that $y=\dfrac{n-g_2^2-h_2^2}{4}$ is an integer.
            
            From (\ref{eq3}), we have $Cg_2+Dh_2=2$.  Set $a=Cy+g_2,b=Dy+h_2, c=y $; then we have
          \begin{displaymath}
          \begin{aligned}
            a^2+b^2-dc^2&=(Cy+g_2)^2+(Dy+h_2)^2-dy^2\\&=2(Cg_2+Dh_2)y+g_2^2+h_2^2=n,
            \end{aligned}
          \end{displaymath}
            where $a=Cy+g_2 \neq 0,b=Dy+h_2\neq 0, c=y\neq 0$.
            \item[Second case:] $n\equiv 0 \pmod 4$.
            
            Since $D,C$ are odd, we can choose $k'\in \mathbb{Z}$ such that $g'+Dk'$ is even.\\
            From (\ref{eq3}), we have $$C(g'+Dk')+D(h'-Ck')=2.$$
            Because $g'+Dk'$ is even, $h'-Ck'$ is even.
            
            We see that
             $$\displaystyle \lim_{t\rightarrow +\infty} \left |n-(g'+D(k'+2t))^2-(h'-C(k'+2t))^2\right |=+\infty;$$
              $$\displaystyle \lim_{t\rightarrow +\infty}\left |C\cdot\dfrac{n-(g'+D(k'+2t))^2-(h'-C(k'+2t))^2}{2}+(g'+D(k'+2t))\right|=+\infty; $$
                $$ \displaystyle \lim_{t\rightarrow +\infty}\left |D\cdot\dfrac{n-(g'+D(k'+2t))^2-(h'-C(k'+2t))^2}{2}+(h'-C(k'+2t))\right|=+\infty.$$
          
            So we can choose a large enough positive integer $t'$  such that
                 $$n-(g'+D(k'+2t'))^2-(h'-C(k'+2t'))^2\neq 0;$$
                $$C\cdot\dfrac{n-(g'+D(k'+2t'))^2-(h'-C(k'+2t'))^2}{2}+(g'+D(k'+2t'))\neq 0;$$
               $$D\cdot\dfrac{n-(g'+D(k'+2t'))^2-(h'-C(k'+2t'))^2}{2}+(h'-C(k'+2t'))\neq 0.$$
          
Set $g_3=g'+D(k'+2t'), h_3=h'-C(k'+2t'), y_1=\dfrac{n-g_3^2-h_3^2}{4}$.
Then $y_1\ne 0, Cy_1+g_3\ne 0, Dy_1+h_3\ne 0 $ and both $g_3,h_3$ are even.
Because  $g_3,h_3$ are even, we have $g_3^2+h_3^2\equiv n \pmod 4$ and so that
 $y_1=\dfrac{n-g_3^2-h_3^2}{4}$ is an integer.
            
From (\ref{eq3}) we have $Cg_3+Dh_3=2$. Set $$a=Cy_1+g_3,b=Dy_1+h_3, c=y_1; $$
            then we have
          \begin{displaymath}
          \begin{aligned}
            a^2+b^2-dc^2&=(Cy_1+g_3)^2+(Dy_1+h_3)^2-dy_1^2\\&=2(Cg_3+Dh_3)y_1+g_3^2+h_3^2=n,
            \end{aligned}
           \end{displaymath}
            where $a=Cy_1+g_3 \neq 0,b=Dy_1+h_3\neq 0, c=y_1\neq 0$.
        \end{itemize}
            \end{itemize}
\end{itemize}
Combining (i) and (ii), we have the desired proof.
\end{proof}
\section{Acknowledgments}
The authors would like to thank the referee and the editor-in-chief for useful comments and suggestions. The second author thanks Hanoi National University of Education for the support during his work on this paper.
\begin{thebibliography}{9}
\bibitem {Now}  A. Nowicki, The number $a^2+b^2-dc^2$, {\it J. Integer Sequences} \textbf {18} (2015), \href{https://cs.uwaterloo.ca/journals/JIS/VOL18/Nowicki/nowicki3.html}{Article 15.2.3}.

\bibitem{PT} S. Prugsapitak and N. Thongngam, Representation of integers
of the form $x^2 + my^2 - z^2$, {\it J. Integer Sequences} \textbf {24}
(2021), \href{https://cs.uwaterloo.ca/journals/JIS/VOL24/Prugsapitak/prug3.html}{Article 24.7.7}.

\bibitem {Sie} W. Sierpi\'nski, {\it Elementary Theory of Numbers},
North-Holland, 1988.

\end{thebibliography}



\bigskip
\hrule
\bigskip

\noindent 2010 {\it Mathematics Subject Classification}:
Primary 11E25.

\noindent \emph{Keywords: } sum of squares.

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received April 27 2021;
revised version received  September 27 2021.
Published in {\it Journal of Integer Sequences}, October 1 2021.

\bigskip
\hrule
\bigskip

\noindent
Return to
\htmladdnormallink{Journal of Integer Sequences home page}{https://cs.uwaterloo.ca/journals/JIS/}.
\vskip .1in


\end{document}

                                                                                



 
