\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 
Sums of Squares, Triangular Numbers, \\
\vskip .1in
and Divisor Sums
}
\vskip 1cm
G. E. Andrews\footnote{Author is partially supported by Simons Foundation Grant 633284.}\\
Department of Mathematics\\
Pennsylvania State University\\
University Park, PA 16802\\
USA \\
\href{mailto:ea1@psu.edu}{\tt ea1@psu.edu}\\
\ \\
Sumit Kumar Jha\\
310, CS-Luxurio\\
Gachibowli \\
Hyderabad  \\
India\\
\href{mailto:sumitkumarjha.iiit@gmail.com}{\tt sumitkumarjha.iiit@gmail.com}\\
\ \\
J. L\'{o}pez-Bonilla\\
ESIME-Zacatenco\\ Instituto Polit\'{e}cnico Nacional
Edif.\ 4, 1er.\ Piso\\
Col.\ Lindavista \\ 
07738 Ciudad de M\'exico\\
Mexico\\
\href{mailto:jlopezb@ipn.mx}{\tt jlopezb@ipn.mx}\\
\end{center}


\vskip .2 in

\begin{abstract}
We prove a general theorem that can be used to derive recurrences for familiar arithmetic functions such as $r_k (n)$ and $t_k (n)$, the number of representations of $n$  as a sum of $k$ squares and $k$ triangular numbers, respectively.
\end{abstract}

\section{Introduction}
Jacobi first investigated the relationship between the sum of squares and divisor sums. Legendre also found formulas relating the sum of triangular numbers to divisor sums. The history of developments in this area has been covered by Dickson \cite[Chaps.\ VI--IX]{Dickson}. More recent treatments include Grosswald \cite{Grosswald1} and Moreno-Wagstaff \cite{Moreno-Wagstaff}.

In this paper, we prove a general theorem that gives a number of recurrences,
including the following:
\begin{equation}
    r_{k}(n) = \frac{-2k}{n}\sum_{j=1}^{n}(-1)^{j}\, j\, D(j)\, r_{k}(n-j), \qquad n\geq 1
\end{equation}
where $r_{k}(n)$ denotes the number of representations of a positive integer $n$ as a sum of $k$ squares, and  $D(n)$ gives the sum of the reciprocals of the 
odd divisors of  $n$.

We also prove that
\begin{equation}
t_{k}(n)=\frac{-k}{n}\sum_{j=1}^{n}j\, T(j)\, t_{k}(n-j),
\end{equation}
where $t_k (n)$ is the number of representations of $n$ as the sum of $k$  triangular numbers, representations with different orders are counted as unique, and
\begin{equation}
\label{T(n)}
T(j) = \sum_{d\mid j}\frac{1+2\, (-1)^{d}}{d}=\frac{1}{j}\sum_{d\mid j}(-1)^{d}\, d.
\end{equation}
We state and prove our main theorem in Section~\ref{sectiontwo}.
Section~\ref{sectionThree} is devoted to three special cases of this theorem.
\section{The main theorem}
\label{sectiontwo}
\begin{theorem}
\label{mainTh}
Let $F(q)$ and $G(q)$ be two analytic functions of $q$ for $|q|<1$ with $F(0)=1$ and $G(0)=0$. Further, let 
$$
q\, \frac{d}{dq}\log{F(q)}=G(q), \qquad (F(q))^{k}=\sum_{n=0}^{\infty}f_{k}(n)\, q^{n}, \qquad G(q)=\sum_{n=1}^{\infty}g_{n}\, q^{n}.
$$
Then 
\begin{equation}
\label{rfirst}
    f_{k}(n)=\frac{k}{n}\sum_{j=1}^{n}g_{j}\, f_{k}(n-j),
\end{equation}
\begin{equation}
\label{rsecond}
    g_{n}=-n\sum_{k=1}^{n}\frac{(-1)^{k}}{k}\, \binom{n}{k}\, f_{k}(n).
\end{equation}
\end{theorem}
\begin{proof}
From the hypotheses it is clear that $f_k (0)=1$, for $k\geq 0$, $f_0 (n)=\delta_{0n}$ ($\delta_{ij}$ denotes the Kronecker delta), and $g_0=0$. Furthermore, we have
\begin{align*}
    q\, \frac{d}{dq}(F(q))^{k} &= \sum_{n=0}^{\infty}n \, f_{k}(n)\, q^{n}\\
    &= k\, (F(q))^{k}\, G(q)\\
    &= k \left(\sum_{j=0}^{\infty}f_{k}(j)\, q^{j}\right)\, \left(\sum_{l=0}^{\infty}g_{l}\, q^{l}\right)\\
    &= k \, \sum_{n=0}^{\infty}\left(\sum_{j=1}^{n}g_{j}\, f_{k}(n-j)\right)\, q^{n},
\end{align*}
which on comparison of coefficients of $q^{n}$ on both the sides gives \eqref{rfirst}.

To prove \eqref{rsecond}, we use the generating function for the incomplete exponential Bell polynomials \cite[p.\ 133]{Comtet} to deduce that
\begin{align*}
    k!\, \sum_{n=k}^{\infty}B_{n,k}\left(F'(0), F''(0),\ldots, F^{(n-k+1)}(0)\right)\, \frac{q^{n}}{n!}
    &= \left(\sum_{j=1}^{\infty}F^{(j)}(0)\, \frac{q^{j}}{j}\right)^{k}\\
    &= (F(q)-1)^{k}\\
    &= \sum_{m=0}^{k}\binom{k}{m}\, (-1)^{k-m}\, (F(q))^{m}\\
    &= \sum_{m=0}^{k}\binom{k}{m}\, (-1)^{k-m}\sum_{n=0}^{\infty}f_{m}(n)\, q^{n}
\end{align*}
which on comparison of coefficients of $q^{n}$ on both the sides gives
\begin{equation}
\label{genBell}
    B_{n,k}\left(F'(0), F''(0),\ldots, F^{(n-k+1)}(0)\right) = \frac{n!}{k!}\sum_{m=0}^{k}(-1)^{k-m}\, \binom{k}{m} \, f_{m}(n).
\end{equation}
Now we use Fa\`{a} di Bruno's formula \cite{Johnson}:
$$
\frac{d^{n}}{dq^{n}}Q(F(q))=\sum_{k=1}^{n}Q^{(k)}\left(F(q)\right)\, B_{n,k}\left(F'(q), F''(q),\ldots, F^{(n-k+1)}(q)\right)
$$
with $Q(q)=\log{q}$ and let $q\rightarrow 0$ to deduce that
\begin{align*}
    \frac{-1}{n}g_{n} &= \frac{1}{n!}\sum_{k=1}^{n}(-1)^{k}\, (k-1)!\,B_{n,k}\left(F'(0), F''(0),\ldots, F^{(n-k+1)}(0)\right) \\
    &= 
    \frac{1}{n!}\sum_{k=1}^{n}(-1)^{k}\, (k-1)! \, \frac{n!}{k!}\sum_{m=0}^{k}(-1)^{k-m}\, \binom{k}{m} \, f_{m}(n) \qquad(\text{using \eqref{genBell}})\\
    &= \sum_{k=1}^{n}\frac{(-1)^k}{k}\sum_{m=1}^{k}(-1)^{k-m}\, \binom{k}{m}\, f_{m}(n) \\
    &= \sum_{m=1}^{n}(-1)^m\, f_{m}(n)\, \sum_{k=m}^{n}\frac{1}{k}\, \binom{k}{m}\\
    &= \sum_{m=1}^{n}(-1)^m\, f_{m}(n)\, \frac{1}{m}\binom{n}{m},
\end{align*}
where in the last step we have used the known ``hockey stick'' identity \cite{Zagier, Jones}
$$
\sum_{k=m}^{n}\frac{1}{k}\, \binom{k}{m} = \frac{1}{m}\binom{n}{m}.
$$
This completes our proof.
\end{proof}
\section{Three applications of the theorem}
\label{sectionThree}
\begin{corollary}
    We have
    \begin{equation}
    \label{c11}
        r_{k}(n) = \frac{-2k}{n}\sum_{j=1}^{n}(-1)^{j}\, j\, D(j)\, r_{k}(n-j) \qquad (n\geq 1),
    \end{equation}
    and 
    \begin{equation}
    \label{c12}
        D(n)=\frac{1}{n}\sum_{k=1}^{n}\frac{(-1)^{n-k}}{k}\, \binom{n}{k}\, r_{k}(n),
    \end{equation}
where $D(n)$  is the sum of the inverses of the odd divisors of $n$,
that is, $D(n)=\sum_{{d\mid n}\atop{d\,{\rm{odd}}}}\frac{1}{d}$.
\end{corollary}
\begin{remark}
    Equation \eqref{c12} was obtained by Jha \cite{Jha2}.
\end{remark}
\begin{proof}
    In Theorem \ref{mainTh}, we let
    $$
    F(q)=\sum_{n=-\infty}^{\infty}(-1)^{n}\, q^{n^2}=\prod_{n=1}^{\infty}\frac{1-q^n}{1+q^n} \qquad \text{\cite[Eq.\ (2.2.12) on p.\ 23]{Andrews}}.
    $$
    Then $f_{k}(n)=(-1)^{n}\,r_{k}(n)$. We can also deduce that
    \begin{align*}
\log{F(q)}&=\sum_{j=1}^{\infty}\log(1-q^{j})-\sum_{j=1}^{\infty}\log(1+q^{j})\\
&=-\sum_{j=1}^{\infty}\sum_{l=1}^{\infty}\frac{q^{lj}}{l}+\sum_{j'=1}^{\infty}\sum_{l'=1}^{\infty}\frac{q^{l'j'}(-1)^{l'}}{l'}\\
&=-\sum_{n=1}^{\infty}q^{n}\left(\sum_{d\mid n}\frac{1-(-1)^{d}}{d}\right)\\
&= -2\,\sum_{n=1}^{\infty} D(n)\, q^{n}.
\end{align*}
Now using \eqref{rfirst} and \eqref{rsecond} we get \eqref{c11} and \eqref{c12}, respectively.
\end{proof}
\begin{corollary}
    We have
    \begin{equation}
    \label{c21}
t_{k}(n)=\frac{-k}{n}\sum_{j=1}^{n}j\, T(j)\, t_{k}(n-j),
\end{equation}
and 
\begin{equation}
\label{c22}
    T(n)=\sum_{k=1}^{n}\frac{(-1)^{k}}{k}\, \binom{n}{k}\, t_{k}(n),
\end{equation}
where $T(n)$ is given by \eqref{T(n)}.
\end{corollary}
\begin{proof}
In Theorem \ref{mainTh}, we let
$$
    F(q)=\sum_{n=0}^{\infty}q^{\frac{(n)(n+1)}{2}}=\prod_{j=1}^{\infty}\frac{(1-q^{2j})^2}{(1-q^{j})}=\prod_{j=1}^{\infty}(1+q^{j})^2\, (1-q^j) \qquad\text{\cite[Eq.\ (2.2.13) on p.\ 23]{Andrews}}.
$$
Then $$f_{k}(n)=t_{k}(n).$$ We can also deduce that
\begin{align*}
\log(F(q))&=\sum_{j=1}^{\infty}2\,\log(1+q^{j})+\sum_{j=1}^{\infty}\log(1-q^{j})\\
&=-\sum_{j=1}^{\infty}\sum_{l=1}^{\infty}2\,\frac{(-1)^{l}\,q^{lj}}{l}-\sum_{j'=1}^{\infty}\sum_{l'=1}^{\infty}\frac{q^{l'j'}}{l'}\\
&=-\sum_{n=1}^{\infty}q^{n}\,\sum_{d\mid n} \frac{1+2\,(-1)^{d}}{d}.
\end{align*}
Now using \eqref{rfirst} and \eqref{rsecond} we get \eqref{c11} and \eqref{c12}, respectively.
\end{proof}
\begin{remark}
Robbins \cite{Robbins} has shown the relation
\begin{equation}
    \sum_{{d\mid n}\atop{d\;{\rm{odd}}}}d =
    n\sum_{d\mid n}\frac{(-1)^{d-1}}{d} . 
\end{equation}
This implies the second equality in \eqref{T(n)}.
\end{remark}
\begin{corollary}
    Let $\prod_{n\geq 1}(1-q^{n})^{k}=\sum_{n=0}^{\infty}p_{k}(n)\, q^{n}$. Then we have
    \begin{equation}
    \label{c31}
        p_{k}(n)=\frac{-k}{n}\sum_{j=1}^{n}\sigma(j)\, p_{k}(n-j),
    \end{equation}
    and 
    \begin{equation}
    \label{c32}
        \sigma(n)=n\sum_{k=1}^{n}\frac{(-1)^{k}}{k}\, \binom{n}{k}\, p_{k}(n),
    \end{equation}
    where $\sigma(n)=\sum_{d\mid n}d$.
\end{corollary}
\begin{remark}
Equation \eqref{c31} was first obtained by Gandhi \cite{Gandhi1, Gandhi2}. Equation \eqref{c32} was obtained by Jha \cite{Jha1}.
\end{remark}
\begin{proof}
In Theorem \ref{mainTh}, we let
$$
F(q)=\prod_{n\geq 1}(1-q^{n}) = \sum_{n=-\infty}^{\infty}(-1)^{n}q^{\frac{3n^{2}+n}{2}}.
$$
Then $f_{k}(n)=p_{k}(n)$, which denotes the number of partitions of $n$ with $k$ colors. We can also deduce that
\begin{align*}
\log(F(q))&=\sum_{j=1}^{\infty}\log(1-q^{j})\\
&=-\sum_{j=1}^{\infty}\sum_{l=1}^{\infty}\frac{q^{lj}}{l}\\
&=-\sum_{n=1}^{\infty}q^{n}\left(\sum_{d\mid n}\frac{1}{d}\right) \\&= -\sum_{n=1}^{\infty}\frac{\sigma(n)\, q^{n}}{n}. 
\end{align*}
Now using \eqref{rfirst} and \eqref{rsecond} we get \eqref{c31} and \eqref{c32}, respectively.
\end{proof}
\begin{remark}
    Letting $k=-1$ in the equation \eqref{c31} gives the well-known relation:
    $$
    n\, p(n)=\sum_{j=1}^{n}\sigma(j)\, p_{k}(n-j).
$$
Furthermore, letting $k=1$ gives an identity obtained by Osler-Hassen-Chandrupatla \cite{Osler}
$$
\sigma(n)=-n\, a_{n}-\sum_{j=1}^{n-1}\sigma(j)\, a_{n-j} \quad (n\geq 2),
$$
where
$$
a_{j}
=\begin{cases}
    0, & \text{if } j\neq \frac{N}{2}(3N+1); \\
    (-1)^{N}, & \text{if } j = \frac{N}{2}(3N+1).
\end{cases}
$$
Here $N=0, \pm 1, \pm 2, \ldots$.
\end{remark}

\begin{thebibliography}{99}
\bibitem{Comtet}
L. Comtet, \emph{Advanced Combinatorics: The Art of Finite and Infinite Expansions}, Springer, 2011.
\bibitem{Dickson}
L. E. Dickson, \emph{History of the Theory of Numbers. Vol. II: Diophantine Analysis},  Dover Publications, 2005.
\bibitem{Moreno-Wagstaff}
C. J. Moreno and S. S. Wagstaff Jr., \emph{Sums of Squares of Integers}, Chapman \& Hall/CRC, 2006.
\bibitem{Grosswald1}
E. Grosswald, \emph{Topics from the Theory of Numbers}, Birk\"{a}user, 1984.
\bibitem{Johnson}
 W. P. Johnson, The curious history of Fa\`{a} di Bruno's formula, \emph{Amer. Math. Monthly} \textbf{109} (2002), 217--234.
\bibitem{Jones}
C. H. Jones, Generalized hockey stick identities and $N$-dimensional block walking, \emph{Fibonacci Quart.} 
         \textbf{34} (1996), 280--288.
\bibitem{Zagier}
T. Arakawa, T. Ibukiyama, and M. Kaneko, \emph{Bernoulli numbers and Zeta Functions}, Springer, 2014.
\bibitem{Andrews}
G. E. Andrews, \emph{The Theory of Partitions}, Cambridge University Press, 1998.
\bibitem{Robbins}
N. Robbins, On partition functions and divisor sums, \emph{J. Integer Sequences} \textbf{5} (2002), \href{https://cs.uwaterloo.ca/journals/JIS/VOL5/Robbins/robbins4.html}{Article 02.1.4}.
\bibitem{Osler}
T. J. Osler, A. Hassen, and T. R. Chandrupatla, Surprising connections between partitions and divisors, \emph{College Math. J.} \textbf{38} (2007), 278--287.
\bibitem{Gandhi1}
J. M. Gandhi, Congruences for $p_r (n)$ and Ramanujan's $\tau$-function, \emph{Amer. Math. Monthly} \textbf{70} (1963), 265--274.
\bibitem{Gandhi2}
O. Lazarev, M. Mizuhara, and B. Reid, Some results in partitions, plane partitions, and multipartitions,
Summer 2010 REU program in mathematics at Oregon State University,  2010.
\bibitem{Jha1}
S. Kumar Jha, A combinatorial identity for the sum of divisors function involving  $p_r (n)$, \emph{Integers} \textbf{20} (2020), Paper \#A97.
\bibitem{Jha2}
S. Kumar Jha, An identity for the sum of inverses of odd divisors of  $n$  in terms of the number of 
      representations of  $n$  as a sum of squares, \emph{Rocky Mountain J. Math.} \textbf{51} (2021) 581--583.
\end{thebibliography}
\bigskip
\hrule
\bigskip

\noindent 2020 {\it Mathematics Subject Classification}:
Primary 11A99, Secondary 11P99. 

\noindent \emph{Keywords:} sum of divisors function, colour partition,
sum of inverses of odd divisors of an integer, triangular number,
sum of squares.

\bigskip
\hrule
\bigskip

\noindent (Concerned with sequences
\seqnum{A000041} and
\seqnum{A000118}.)

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received  October 15 2022;
revised versions received  October 16 2022; February 9 2023; February 12 2023;
February 25 2023.
Published in {\it Journal of Integer Sequences}, February 25 2023.

\bigskip
\hrule
\bigskip

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


\end{document}

                                                                                

