<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[12pt,reqno]{article}

\usepackage[usenames]{color}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amscd}

\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,amsmath,amssymb}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{latexsym}
\usepackage{epsf}

\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{.1in}
\setlength{\evensidemargin}{.1in}
\setlength{\topmargin}{-.1in}
\setlength{\textheight}{8.4in}

\newcommand{\seqnum}[1]{\href{http://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 
Jacobsthal and Jacobsthal-Lucas Numbers \\
\vskip .03in
and Sums Introduced by Jacobsthal and  \\
\vskip .10in
Tverberg
}
\vskip 1cm
\large
Kritkhajohn Onphaeng and 
Prapanpong Pongsriiam\footnote{Prapanpong Pongsriiam receives financial support jointly from Faculty of Science Silpakorn University, and The Thailand Research Fund, grant number RSA5980040. Correspondence should be addressed to Prapanpong Pongsriiam: \href{mailto:prapanpong@gmail.com}{\tt prapanpong@gmail.com} .} \\
Department of Mathematics \\
Faculty of Science\\
Silpakorn University\\
Nakhon Pathom 73000 \\
Thailand\\
\href{mailto:dome3579@gmail.com}{\tt dome3579@gmail.com} \\
\href{mailto:prapanpong@gmail.com}{\tt prapanpong@gmail.com} \\
\end{center}


\newcommand{\lrf}[1]{\left\lfloor #1\right\rfloor}

\vskip .2 in

\begin{abstract}
We study the sums introduced by Jacobsthal and Tverberg and show that
the extreme values of the sums are connected with Jacobsthal and
Jacobsthal-Lucas numbers.
\end{abstract}

\section{Introduction}

Let $a,b\in\mathbb{Z}$ and $m\in\mathbb{Z}^+$. In 1957, Jacobsthal \cite{EJ1957} introduced the sums of the form 

\begin{equation*}
S_{a,b;m}(K) =\sum_{k=0}^{K}f_{a,b;m}(k),
\end{equation*}
where
\begin{equation}\label{f_jacobsthal}
f_{a,b;m}(k) =\left\lfloor\frac{a+b+k}{m}\right\rfloor-\left\lfloor\frac{a+k}{m}\right\rfloor-\left\lfloor\frac{b+k}{m}\right\rfloor+\left\lfloor\frac{k}{m}\right\rfloor.
\end{equation}

In the above equation and throughout this article, unless stated otherwise, $k$ is an integer and $K$ is a nonnegative integer. So we can consider $f_{a,b;m}$ and $S_{a,b;m}$ as functions of $k$ and $K$ defined on $\mathbb Z$ and on $\mathbb N\cup\{0\}$, respectively.

These sums are also studied by Carlitz \cite{LC1959,LC1960}, Grimson \cite{RG1974} and recently by Tverberg \cite{HT2012}. In addition, Tverberg \cite{HT2012} extends the definition of $f_{a,b;m}(k)$ and $S_{a,b;m}(K)$ to the following form.

\begin{definition}\label{def_tver}
Let $m$ and $\ell$ be positive integers and let $C$ be a multiset of $\ell$ integers $a_1,a_2,\ldots,a_{\ell}$, i.e., $a_i=a_j$ is allowed for some $i\neq j$. Define $f_{C;m}:\mathbb{Z}\rightarrow\mathbb{Z}$ and $S_{C;m}:\mathbb{N}\cup\{0\}\rightarrow\mathbb{Z}$ by
$$
f_{C;m}(k)=\sum_{T\subseteq[1,\ell]}(-1)^{\ell-|T|}\left\lfloor\frac{k+\sum_{i\in T}a_i}{m} \right\rfloor,
$$
$$
S_{C;m}(K)=\sum_{k=0}^{K}f_{C;m}(k).
$$
We sometimes write $f_{a_1,a_2,\ldots,a_\ell;m}(k)$ and $S_{a_1,a_2,\ldots,a_\ell;m}(K)$ instead of $f_{C;m}(k)$ and $S_{C;m}(K)$, respectively. The set $[1,\ell]$ appearing in the sum defining $f$ is $\{1,2,3,\ldots,\ell \}$ and if $T=\emptyset$, then $\sum_{i\in T}a_i$ is defined to be zero.
\end{definition}

For example, if $C=\{a,b\}$, then $f_{C;m}(k)$ given in Definition \ref{def_tver} is the same as $f_{a,b;m}(k)$ given in \eqref{f_jacobsthal}, and if $C=\{a_1,a_2,a_3\}$, then $f_{C;m}(k)$ is 
\begin{align*}
f_{a_1,a_2,a_3;m}(k)&amp;=\left\lfloor \frac{a_1+a_2+a_3+k}{m}\right\rfloor-\left\lfloor \frac{a_1+a_2+k}{m}\right\rfloor-\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor-\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor\\
&amp;\quad+\left\lfloor \frac{a_1+k}{m}\right\rfloor+\left\lfloor \frac{a_2+k}{m}\right\rfloor+\left\lfloor \frac{a_3+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor.
\end{align*}
Jacobsthal \cite{EJ1957} shows that for any $K\in \mathbb N\cup\{0\}$, we have
\begin{align}\label{eq_S_ab}
0\leq S_{a,b;m}(K)\leq \left\lfloor\frac{m}{2}\right\rfloor,
\end{align}
which is a sharp inequality, that is, the lower bound $0$ is actually the minimum value and the upper bound $\left\lfloor\frac{m}{2}\right\rfloor$ is the maximum value of $S_{a,b;m}(K)$. Tverberg \cite{HT2012} proves \eqref{eq_S_ab} in a different way and he also gives the extreme values of $S_{a_1,a_2,a_3;m}(K)$ without proof. Nevertheless, the extreme values of $f_{a_1,a_2,\ldots,a_\ell;m}(k)$ (for $\ell\geq2$) and $S_{a_1,a_2,\ldots,a_\ell;m}(K)$ (for $\ell\geq4$) have not been calculated. 

In this article, we calculate the extreme values of $f_{a_1,a_2,\ldots,a_\ell;m}(k)$ for all $\ell\geq2$ (see Theorem \ref{maintheorem_f}). We also introduce the function $g$ in Definition \ref{def:first}, give its connection with $f_{a_1,a_2,\ldots,a_\ell;m}(k)$, and obtain its extreme values (see Proposition \ref{prop} and Theorem \ref{maintheorem_g}). Furthermore, we obtain the minimum value of $S_{a_1,a_2,\ldots,a_\ell;m}(K)$ when $\ell$ is odd and the maximum value of $S_{a_1,a_2,\ldots,a_\ell;m}(K)$ when $\ell$ is even (see Theorem \ref{neqtheorem9}).

The reader will see that the extreme values of the functions $g$ and $f_{a_1,a_2,\ldots,a_\ell;m}(k)$ are connected with Jacobsthal numbers $J_n$ and Jacobsthal-Lucas numbers $j_n$ defined, respectively, by the recurrence relations
\begin{equation*}
J_0=0, \quad J_1=1, \quad J_n=J_{n-1}+2J_{n-2} \quad\text{for $n\geq2$},
\end{equation*}
 and 
\begin{equation*}
j_0=2,\quad j_1=1,\quad j_n=j_{n-1}+2j_{n-2}\quad \text{for $n\geq2$}. 
\end{equation*}
The sequences $(J_n)_{n\geq0}$ and $(j_n)_{n\geq0}$ are, respectively, \seqnum{A001045} and \seqnum{A014551} in the OEIS \cite{OE}. The function $g$ is defined as follows:

\begin{definition}\label{def:first}
	Let $g:\mathbb{R}^n\rightarrow\mathbb{Z}$ be given by
	\begin{align*}\label{function_g}
	g(x_1,x_2,x_3,&amp;\ldots,x_n)=\sum_{1\leq i \leq n}\lfloor x_i\rfloor-\sum_{1\leq i_1&lt; i_2\leq n}\lfloor x_{i_1}+x_{i_2}\rfloor\notag\\
	&amp;+\sum_{1\leq i_1&lt;i_2&lt;i_3\leq n}\lfloor x_{i_1}+x_{i_2}+x_{i_3}\rfloor-\cdots+(-1)^{n-1}\lfloor x_1+x_2+x_3+\cdots +x_n \rfloor.
	\end{align*}
	In other words, $$g(x_1,x_2,x_3,\ldots,x_n)=\sum_{\emptyset\neq T\subseteq[1,n]}(-1)^{|T|-1}\left\lfloor\sum_{i\in T}x_i \right\rfloor.$$
\end{definition}


\section{Main results}
We begin this  section by giving a relation between the functions $f$ and $g$. Then we give the extreme values of $g$ and $f$ and their connection with Jacobsthal and Jacobsthal-Lucas numbers.

\begin{proposition}\label{prop}
	For each $\ell\geq2$, we have
	\begin{itemize}
		\item[\rm{(i)}] $f_{a_1,a_2,\ldots,a_\ell;m}(0)=(-1)^{\ell-1}g\left(\frac{a_1}{m},\frac{a_2}{m},\cdots,\frac{a_\ell}{m}\right)$,
		\item[\rm{(ii)}] $f_{a_1,a_2,\ldots,a_\ell;m}(k)=(-1)^{\ell}g\left(\frac{a_1}{m},\frac{a_2}{m},\cdots,\frac{a_\ell}{m},\frac{k}{m}\right)+(-1)^{\ell-1}g\left(\frac{a_1}{m},\frac{a_2}{m},\cdots,\frac{a_\ell}{m}\right)$.
	\end{itemize}
\end{proposition}

\begin{proof}
This follows easily from the definitions of $f$ and $g$ but we give a proof for completeness. We have
	\begin{align*}
	f_{a_1,a_2,\ldots,a_\ell;m}(0)&amp;=\sum_{T\subseteq[1,\ell]}(-1)^{\ell-|T|}\left\lfloor\sum_{i\in T}\left(\frac{a_i}{m}\right) \right\rfloor\\
	&amp;=\sum_{\emptyset\neq T\subseteq[1,\ell]}(-1)^{\ell-|T|}\left\lfloor\sum_{i\in T}\left(\frac{a_i}{m}\right) \right\rfloor\\
	&amp;=(-1)^{\ell-1}\sum_{\emptyset\neq T\subseteq[1,\ell]}(-1)^{1-|T|}\left\lfloor\sum_{i\in T}\left(\frac{a_i}{m}\right) \right\rfloor\\
	&amp;=(-1)^{\ell-1}g\left(\frac{a_1}{m},\frac{a_2}{m},\ldots,\frac{a_\ell}{m}\right).
	\end{align*}
	 Next let $a_{\ell+1}=k$. Then we obtain
	 \begin{align*}
	 &amp;(-1)^{\ell}g\left(\frac{a_1}{m},\frac{a_2}{m},\cdots,\frac{a_\ell}{m},\frac{k}{m}\right)+(-1)^{\ell-1}g\left(\frac{a_1}{m},\frac{a_2}{m},\cdots,\frac{a_\ell}{m}\right)\\
	 =&amp;(-1)^\ell\left( \sum_{\emptyset\neq T\subseteq[1,\ell+1]}(-1)^{|T|-1}\left\lfloor\sum_{i\in T}\left(\frac{a_i}{m}\right) \right\rfloor -\sum_{\emptyset\neq T\subseteq[1,\ell]}(-1)^{|T|-1}\left\lfloor\sum_{i\in T}\left(\frac{a_i}{m}\right) \right\rfloor\right)\\
	 =&amp;(-1)^\ell\sum_{\substack {T\subseteq[1,\ell+1]\\ \ell+1\in T}}(-1)^{|T|-1}\left\lfloor\sum_{i\in T}\left(\frac{a_i}{m}\right) \right\rfloor\\
	 =&amp;(-1)^\ell\sum_{T\subseteq[1,\ell]}(-1)^{|T|}\left\lfloor\frac{k+\sum_{i\in T}a_i}{m} \right\rfloor\\
	 =&amp; f_{a_1,a_2,\ldots,a_\ell;m}(k).
	 \end{align*}
\end{proof}

\begin{theorem} \label{maintheorem_g}
	For each $n\geq 2$, the function $g$ given in Definition \ref{def:first} has maximum value $2^{n-2}-1$ and minimum value $-2^{n-2}$. The minimum occurs at least when $x_k=\frac{1}{2}$ for every $1\leq k\leq n$. The maximum occurs at least when $x_k=\frac{1}{2}-\frac{1}{n^2}$ for every $1\leq k\leq n$.
\end{theorem}
\begin{proof}
	If $n=2$, then the result is a well-known inequality 
	\begin{equation}\label{eqxy}
	-1\leq \lfloor x\rfloor + \lfloor y\rfloor -\lfloor x+y\rfloor \leq 0,
	\end{equation}
	which holds for all $x,y\in\mathbb{R}$. The inequality \eqref{eqxy} is sharp: if $x=y=\frac{1}{2}$ the left inequality in \eqref{eqxy} becomes equality, and if $x=y=\frac{1}{4}$ the right inequality in \eqref{eqxy} becomes equality. The result when $n\geq3$ is obtained from the case $n=2$ and a careful selection of pairs. For illustration purpose, we first give a proof for the case $n=3$ and $n=4$. Recall that
	$$g(x_1,x_2,x_3)=\lfloor x_1\rfloor+\lfloor x_2\rfloor+\lfloor x_3\rfloor-\lfloor x_1+x_2\rfloor-\lfloor x_1+x_3\rfloor-\lfloor x_2+x_3\rfloor+\lfloor x_1+x_2+x_3\rfloor.$$ 
	We obtain by \eqref{eqxy} that 
	\begin{equation}\label{proof-f3-1}
	0\leq \lfloor x_1+x_2+x_3\rfloor-\lfloor x_1+x_2\rfloor-\lfloor x_3\rfloor\leq 1,
	\end{equation}
	\begin{equation}\label{proof-f3-2}
	-1\leq -\lfloor x_2+x_3\rfloor+\lfloor x_2\rfloor+\lfloor x_3\rfloor\leq 0,
	\end{equation}
	\begin{equation}\label{proof-f3-3}
	-1\leq -\lfloor x_1+x_3\rfloor+\lfloor x_1\rfloor+\lfloor x_3\rfloor\leq 0.
	\end{equation} 
	Summing \eqref{proof-f3-1}, \eqref{proof-f3-2}, and \eqref{proof-f3-3}, the middle terms give $g(x_1,x_2,x_3)$. Then $-2\leq g(x_1,x_2,x_3) \leq 1$. Next we consider
	\begin{align*}
	g(x_1,x_2,x_3,x_4)&amp;=\lfloor x_1\rfloor+\lfloor x_2\rfloor+\lfloor x_3\rfloor+\lfloor x_4\rfloor-\lfloor x_1+x_2\rfloor-\lfloor x_1+x_3\rfloor-\lfloor x_1+x_4\rfloor\\
	&amp;\quad-\lfloor x_2+x_3\rfloor-\lfloor x_2+x_4\rfloor-\lfloor x_3+x_4\rfloor+\lfloor x_1+x_2+x_3\rfloor+\lfloor x_1+x_2+x_4\rfloor\\
	&amp;\quad+\lfloor x_1+x_3+x_4\rfloor+\lfloor x_2+x_3+x_4\rfloor-\lfloor x_1+x_2+x_3+x_4\rfloor.
	\end{align*} 
	Again, we obtain by \eqref{eqxy} the following inequalities:
	\begin{equation}\label{proof-f4-1}
	-1\leq -\lfloor x_1+x_2+x_3+x_4\rfloor+\lfloor x_1+x_2+x_3\rfloor+\lfloor x_4\rfloor\leq 0,
	\end{equation}
	\begin{equation}\label{proof-f4-2}
	0\leq \lfloor x_1+x_2+x_4\rfloor-\lfloor x_1+x_2\rfloor-\lfloor x_4\rfloor\leq 1,
	\end{equation}
	\begin{equation}\label{proof-f4-3}
	0\leq \lfloor x_1+x_3+x_4\rfloor-\lfloor x_1+x_3\rfloor-\lfloor x_4\rfloor\leq 1,
	\end{equation}
	\begin{equation}\label{proof-f4-4}
	0\leq \lfloor x_2+x_3+x_4\rfloor-\lfloor x_2+x_3\rfloor-\lfloor x_4\rfloor\leq 1,
	\end{equation}
	\begin{equation}\label{proof-f4-5}
	-1\leq -\lfloor x_1+x_4\rfloor+\lfloor x_1\rfloor+\lfloor x_4\rfloor\leq 0,
	\end{equation}
	\begin{equation}\label{proof-f4-6}
	-1\leq -\lfloor x_2+x_4\rfloor+\lfloor x_2\rfloor+\lfloor x_4\rfloor\leq 0,
	\end{equation}
	\begin{equation}\label{proof-f4-7}
	-1\leq -\lfloor x_3+x_4\rfloor+\lfloor x_3\rfloor+\lfloor x_4\rfloor\leq 0.
	\end{equation} 
	Summing \eqref{proof-f4-1} to \eqref{proof-f4-7}, we see that $-4\leq g(x_1,x_2,x_3,x_4) \leq 3$.
	
	Next we prove the general case $n\geq5$.
	The expression of the form $\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_k}\rfloor$ will be called a \emph{$k$-bracket}. So for each $1\leq k\leq n$, there are ${n\choose k}$ $k$-brackets appearing in the sum defining $g(x_1,x_2,\ldots,x_n)$. We first pair up the $n$-bracket with an $(n-1)$-bracket and a $1$-bracket as follows: 
	\begin{equation}\label{eqx1x2x3-1}
	s_1=(-1)^{n-1}\lfloor x_1+x_2+\cdots+x_n\rfloor+(-1)^{n-2}\lfloor x_1+x_2+\cdots+x_{n-1}\rfloor+(-1)^{n-2}\lfloor x_n\rfloor.
	\end{equation}
	Notice that the sign of $\lfloor x_n \rfloor$ in \eqref{eqx1x2x3-1} may or may not be the same as that appearing in the sum defining $g(x_1,x_2,\ldots,x_n)$ but it is the same as the sign of $\lfloor x_1+x_2+\cdots+x_{n-1} \rfloor$ so that we can apply \eqref{eqxy} to obtain the bound for $s_1$.
	 Next we pair up the remaining $(n-1)$-brackets with $(n-2)$-brackets and $1$-brackets as follows: 
	\begin{equation}\label{proof-1}
	(-1)^{n-2}\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-1}}\rfloor+(-1)^{n-3}\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-2}}\rfloor+(-1)^{n-3}\lfloor x_{i_{n-1}}\rfloor,
	\end{equation}
	where $1\leq i_1&lt;i_2&lt;\ldots&lt;i_{n-1}\leq n$. We note again that the sign of $\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-1}}\rfloor$ and $\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-2}}\rfloor$ in \eqref{proof-1} are the same as those appearing in the sum defining $g(x_1,x_2,\ldots,x_n)$ while the sign of $\lfloor x_{i_{n-1}} \rfloor$ in \eqref{proof-1} may or may not be the same, but we can apply \eqref{eqxy} to obtain the bound of \eqref{proof-1}.
	Since $\lfloor x_1+x_2+\cdots+x_{n-1} \rfloor$ appears in \eqref{eqx1x2x3-1}, the term $x_{i_{n-1}}$ appearing in the $(n-1)$-brackets in \eqref{proof-1} is always $x_n$. So in fact \eqref{proof-1} is 
	\begin{equation}\label{proof-2}
	(-1)^{n-2}\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-2}}+x_n\rfloor+(-1)^{n-3}\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-2}}\rfloor+(-1)^{n-3}\lfloor x_n\rfloor.
	\end{equation}
	Then we sum \eqref{proof-2} over all possibles $1\leq i_1&lt;i_2&lt;\ldots&lt;i_{n-2}&lt;n$, and call it $s_2$. That is 
	\begin{align*}
	s_2&amp;=(-1)^{n-2}\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{n-2}&lt;n}\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-2}}+x_n\rfloor\\
	&amp;\quad+(-1)^{n-3}\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{n-2}&lt;n}\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-2}}\rfloor+(-1)^{n-3}{n-1 \choose n-2}\lfloor x_n \rfloor.
	\end{align*}
	We continue doing this process as follows. For each $0\leq \ell \leq n-1$, let $c_\ell$ be the sum of all $\lfloor x_{i_1}+x_{i_2}+\cdots+x_{i_{n-\ell}}\rfloor$ with $1\leq i_1&lt;i_2&lt;\ldots&lt;i_{n-\ell}\leq n$, $a_\ell$ the sum of all such terms with $i_{n-\ell}=n$, and $b_\ell$ the sum of all such terms with $i_{n-\ell}&lt;n$. Therefore $c_\ell=a_\ell+b_\ell$. As usual, the empty sum is defined to be zero, so $b_0=0$. The number of $(n-\ell)$-brackets appearing in the sum defining $c_\ell$ is ${n\choose n-\ell}$, the number of $(n-\ell)$-brackets appearing in the sum defining $a_\ell$ is ${n-1\choose n-\ell-1}$, and the number of $(n-\ell)$-brackets appearing in the sum defining $b_\ell$ is ${n-1\choose n-\ell}$. 
	In addition, we have 
	\begin{align*}
	s_1&amp;=(-1)^{n-1}a_0+(-1)^{n-2}b_1+(-1)^{n-2}\lfloor x_n \rfloor,\\
	s_2&amp;=(-1)^{n-2}a_1+(-1)^{n-3}b_2+(-1)^{n-3}{n-1\choose n-2}\lfloor x_n \rfloor.
	\end{align*}
	In general, for each $1\leq \ell \leq n-1$, we let 
	\begin{equation*}
	s_\ell=(-1)^{n-\ell}a_{\ell-1}+(-1)^{n-\ell-1}b_\ell+(-1)^{n-\ell-1}{n-1\choose n-\ell}\lfloor x_n \rfloor.
	\end{equation*}
	Then 
	\begin{align}\label{eq:sums_s_l}
	\sum_{1\leq \ell\leq n-1}s_\ell&amp;=(-1)^{n-1}a_0+\sum_{2\leq \ell\leq n-1}(-1)^{n-\ell}a_{\ell-1}+\sum_{1\leq \ell\leq n-2}(-1)^{n-\ell-1}b_\ell+b_{n-1}\notag\\
	&amp;\quad+\lfloor x_n\rfloor\sum_{1\leq \ell\leq n-1}(-1)^{n-\ell-1}{n-1\choose n-\ell}.
	\end{align}
	Recall a well known identity $\sum_{0\leq\ell\leq n}(-1)^\ell{n\choose \ell}=0$ for all $n\geq1$. Therefore the last sum on the right hand side of \eqref{eq:sums_s_l} is 
	
	$$-\sum_{1\leq \ell\leq n-1}(-1)^{n-\ell}{n-1\choose n-\ell}=-\sum_{1\leq \ell\leq n-1}(-1)^{\ell}{n-1\choose \ell}=-\sum_{0\leq \ell\leq n-1}(-1)^{\ell}{n-1\choose \ell}+1=1.$$
	
	Therefore the last term in \eqref{eq:sums_s_l} is $\lfloor x_n\rfloor$. Replacing $\ell$ by $\ell+1$ in the first sum on the right hand side of \eqref{eq:sums_s_l}, we see that  
	
	\begin{align}\label{neweq1}
	\sum_{1\leq \ell\leq n-1}s_\ell&amp;=(-1)^{n-1}a_0+\sum_{1\leq \ell\leq n-2}(-1)^{n-\ell-1}(a_\ell+b_\ell)+b_{n-1}+\lfloor x_n \rfloor\notag\\
	&amp;=(-1)^{n-1}c_0+\sum_{1\leq \ell\leq n-2}(-1)^{n-\ell-1}c_\ell+b_{n-1}+\lfloor x_n \rfloor\notag\\
	&amp;=(-1)^{n-1}c_0+\sum_{1\leq \ell\leq n-2}(-1)^{n-\ell-1}c_\ell+c_{n-1}\\
	&amp;=\sum_{0\leq \ell \leq n-1}(-1)^{n-\ell-1}c_\ell\notag\\
	&amp;=g(x_1,x_2,\ldots,x_n),\notag
	\end{align}
	where \eqref{neweq1} can be obtained from the definition of $c_{n-1}$, $b_{n-1}$, and $a_{n-1}$ that 
	\begin{align*}
	c_{n-1} &amp;= \left\lfloor x_1\right\rfloor+\left\lfloor x_2\right\rfloor+\cdots+\left\lfloor x_n\right\rfloor,\\
	b_{n-1} &amp;= \left\lfloor x_1\right\rfloor+\left\lfloor x_2\right\rfloor+\cdots+\left\lfloor x_{n-1}\right\rfloor,\\
	a_{n-1} &amp;= \left\lfloor x_n\right\rfloor, \quad\text{and}\\
	c_{n-1} &amp;= a_{n-1}+b_{n-1}.
	\end{align*}
	We apply \eqref{eqxy} to \eqref{eqx1x2x3-1} to obtain
	$$
	\text{$0\leq s_1\leq1$ if $n$ is odd, and $-1\leq s_1\leq 0$ if $n$ is even.}
	$$
	 Similarly, applying \eqref{eqxy} to \eqref{proof-2}, we see that such sum lies in $[0,1]$ if $n$ is even, and lies in $[-1,0]$ if $n$ is odd. Therefore 
$$
	0\leq s_2\leq{n-1\choose n-2}\; \text{if $n$ is even, and}\,	-{n-1\choose n-2}\leq s_2\leq0\,\text{if $n$ is odd.}
$$
	In general, for each $1\leq\ell\leq n-1$, we have 
	\begin{align*}
	&amp;0\leq s_\ell \leq {n-1 \choose n-\ell} \text{, if $n$ and $\ell$ have the same parity,}\\
	-&amp;{n-1 \choose n-\ell}\leq s_\ell \leq 0 \text{, if $n$ and $\ell$ have a different parity.}
	\end{align*}
	Since $g(x_1,x_2,\ldots,x_n)=\sum_{1\leq \ell\leq n-1}s_\ell$, we obtain, for odd $n$,
	$$-\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is even}}}{n-1\choose n-\ell}\leq g(x_1,x_2,\ldots,x_n)\leq\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is odd} }}{n-1\choose n-\ell},$$
	and for even $n$,
	$$-\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is odd} }}{n-1\choose n-\ell}\leq g(x_1,x_2,\ldots,x_n)\leq\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is even} }}{n-1\choose n-\ell}.$$
	Recall a well known identity 
	$$\sum_{\substack {0\leq k\leq n\\k\text{ is even} }}{n\choose k}=\sum_{\substack {0\leq k\leq n\\k\text{ is odd} }}{n\choose k}=2^{n-1}.$$
	Therefore if $n$ is odd, then
	$$\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is odd} }}{n-1\choose n-\ell}=\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is even} }}{n-1\choose \ell}=2^{n-2}-1\text{, and}$$
	$$\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is even} }}{n-1\choose n-\ell}=\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is odd} }}{n-1\choose \ell}=\sum_{\substack {0\leq\ell\leq n-1\\\ell\text{ is odd} }}{n-1\choose \ell}=2^{n-2}.$$
	Similarly, if $n$ is even, then
	
	$$\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is odd}}}{n-1\choose n-\ell}=2^{n-2}\text{ and }\sum_{\substack {1\leq\ell\leq n-1\\\ell\text{ is even}}}{n-1\choose n-\ell}=2^{n-2}-1.$$
	
	Hence $-2^{n-2}\leq g(x_1,x_2,\ldots,x_n)\leq2^{n-2}-1$, as required.
	Next we show that the lower bound $-2^{n-2}$ and the upper bound $2^{n-2}-1$ are actually the minimum and the maximum of $g(x_1,x_2,\ldots,x_n)$, respectively. Recall that the fractional part of a real number $x$, denoted by $\{x\}$, is defined by $\{x\}=x-\lfloor x\rfloor$.
	Let $x_k=\frac{1}{2}$ for every $k=1,2,\ldots,n$. Then 
	\begin{align}\label{eq:maxming1}
	g(x_1,x_2,\ldots,x_n)&amp;=\sum_{1\leq k\leq n}(-1)^{k-1}\left\lfloor\frac{k}{2}\right \rfloor{n\choose k}\notag\\
	&amp;=\sum_{1\leq k\leq n}(-1)^{k-1}\left(\frac{k}{2}\right) {n\choose k}-\sum_{1\leq k\leq n}(-1)^{k-1}\left\{\frac{k}{2}\right\}{n\choose k}\notag\\
	&amp;=\frac{1}{2}\sum_{1\leq k\leq n}(-1)^{k-1}k {n\choose k}-\frac{1}{2}\sum_{\substack{1\leq k\leq n\\ k \text{ is odd}}}{n\choose k},
	\end{align}
	where the last equality is obtained from the fact that $\left\{\frac{k}{2}\right\}=0$ if $k$ is even and $\left\{\frac{k}{2}\right\}=\frac{1}{2}$ if $k$ is odd. By differentiating both sides of 
	\begin{align}\label{eq:1+x^n}
	(1+x)^n=\sum_{k=0}^{n}{n\choose k}x^k
	\end{align}
	and substituting $x=-1$, we obtain a well-known identity 
	\begin{align}\label{eq:-1^k-1nchoosek}
	\sum_{k=1}^{n}(-1)^{k-1}k {n\choose k}=0, \text{ which holds for all $n \geq 2$}.
	\end{align}
	In addition, we know that $$\sum_{\substack{1\leq k\leq n\\k \text{ is odd}}}{n\choose k}=2^{n-1}.$$
	Therefore \eqref{eq:maxming1} becomes $$g(x_1,x_2,\ldots,x_n)=0-\frac{1}{2}\left(2^{n-1}\right)=-2^{n-2}.$$
	This shows that $-2^{n-2}$ is the minimun value of $g$. Next let $x_k=\frac{1}{2}-\frac{1}{n^2}$ for every $k=1,2,\ldots,n$. Then 
	\begin{align}\label{eq:maxming2}
	g(x_1,x_2,\ldots,x_n)=\sum_{1\leq k \leq n}(-1)^{k-1}\left\lfloor\frac{k}{2}-\frac{k}{n^2} \right\rfloor{n \choose k}.
	\end{align}
	If $1\leq k \leq n$ and $k$ is even, then $\left\lfloor\frac{k}{2}-\frac{k}{n^2} \right\rfloor=\frac{k}{2}-1=\left\lfloor\frac{k-1}{2} \right\rfloor$.
	If $1\leq k \leq n$ and $k$ is odd, then $\left\lfloor\frac{k}{2}-\frac{k}{n^2} \right\rfloor=\left\lfloor\frac{k-1}{2}+\frac{1}{2}-\frac{k}{n^2} \right\rfloor=\left\lfloor\frac{k-1}{2} \right\rfloor$.
	Therefore \eqref{eq:maxming2} becomes
	\begin{align}\label{eq:maxming3}
	g(x_1,x_2,\ldots,x_n)=\sum_{1\leq k \leq n}(-1)^{k-1}\left\lfloor\frac{k-1}{2} \right\rfloor{n \choose k}.
	\end{align}
	Now we can evaluate the sum \eqref{eq:maxming3} by using the same method as in \eqref{eq:maxming1}. We write $\left\lfloor\frac{k-1}{2}\right\rfloor=\frac{k-1}{2}-\left\{ \frac{k-1}{2}\right\}$ and we know that $\left\{ \frac{k-1}{2}\right\}=0$ if $k$ is odd and $\left\{ \frac{k-1}{2}\right\}=\frac{1}{2}$ if $k$ is even. Then \eqref{eq:maxming3} can be written as
	$$
	g(x_1,x_2,\ldots,x_n)=\frac{1}{2}\sum_{1\leq k \leq n}(-1)^{k-1}k{n \choose k}-\frac{1}{2}\sum_{1\leq k \leq n}(-1)^{k-1}{n \choose k}+\frac{1}{2}\sum_{\substack{1\leq k \leq n\\k \text{ is even}}}{n \choose k}.
	$$
	The first sum is zero by \eqref{eq:-1^k-1nchoosek}. The second sum is $1$ by substituting $x=-1$ in \eqref{eq:1+x^n}. Therefore
	$$
	g(x_1,x_2,\ldots,x_n)=0-\frac{1}{2}+\frac{1}{2}\left(2^{n-1}-1\right)	=2^{n-2}-1.
	$$
\end{proof}
Recall that the Binet forms of Jacobsthal numbers $J_n$ and Jacobsthal-Lucas numbers $j_n$ are 
\begin{equation}\label{J_n,j_n}
J_n=\frac{2^n-(-1)^n}{3}\quad\text{and}\quad j_n=2^n+(-1)^n
\end{equation}
for every $n\geq0$.
Therefore we obtain the connection between Jacobsthal and Jacobsthal-Lucas numbers and sums introduced by Jacobsthal \cite{EJ1957} and Tverberg \cite{HT2012} as follows.
\begin{corollary}
If $n$ is odd, then the maximum and the minimum value of $g(x_1,x_2,x_3,\ldots,x_n)$ are $j_{n-2}$ and $-1-j_{n-2}$, respectively. If $n$ is even, then the maximum and the minimum value of $g(x_1,x_2,x_3,\ldots,x_n)$ are $3J_{n-2}$ and $1-j_{n-2}$, respectively.
\end{corollary}
\begin{proof}
	This follows immediately from \eqref{J_n,j_n} and Theorem \ref{maintheorem_g}.
\end{proof}
\begin{remark}
	From this point on, we will apply the well-known identities which are already recalled without reference.
\end{remark}
Next we give the extreme values of $f_{a_1,a_2,\ldots,a_\ell;m}(k)$.
Although we can write $f_{a_1,a_2,\ldots,a_\ell;m}(k)$ in terms of $g(x_1,x_2,\ldots,x_n)$ as given in Proposition \ref{prop}, we do not know the proof which applies Theorem \ref{maintheorem_g} to obtain Theorem \ref{maintheorem_f}. Nevertheless, we can use the same idea in the proof of Theorem \ref{maintheorem_g} together with the following lemma to prove Theorem \ref{maintheorem_f}.

\begin{lemma}\label{lem:faqm}
The following statements hold.
\begin{itemize}
 	\item[\rm{(i)}]\label{(i)} For each $i\in\{1,2,\ldots,n\}$ and $q\in\mathbb{Z}$, we have
 	$$g(x_1,x_2,\ldots,x_i+q,\ldots,x_n)=g(x_1,x_2,\ldots,x_n).$$
 	In particular, $g$ has period $1$ in each variable.
 	\item[\rm{(ii)}] For each $i\in\{1,2,\ldots,\ell\}$ and $q\in\mathbb{Z}$, we have
 	$$f_{a_1,a_2,\ldots,a_i+qm,\ldots,a_\ell;m}(k)=f_{a_1,a_2,\ldots,a_\ell;m}(k)=f_{a_1,a_2,\ldots,a_\ell;m}(k+qm).$$
 	In particular, $f$ has period $m$ in each variable $a_1,a_2,\ldots,a_\ell$ and $k$.
\end{itemize}
\end{lemma}
\begin{proof}
Since $\left\lfloor q+x \right\rfloor=q+\lfloor x\rfloor$ for every $q\in\mathbb{Z}$ and $x\in\mathbb{R}$, we see that 
\begin{align*}
g(x_1,x_2,\ldots,x_i+q,\ldots,x_n)&amp;=\left( q+\sum_{i=1}^{n}\lfloor x_i\rfloor\right)-\left( {n-1\choose 1}q+\sum_{1\leq i_1&lt;i_2\leq n}\left\lfloor x_{i_1}+x_{i_2}\right \rfloor\right)\\
&amp;\quad+\left({n-1\choose 2}q+\sum_{1\leq i_1&lt;i_2&lt;i_3\leq n}\left\lfloor x_{i_1}+x_{i_2}+x_{i_3}\right \rfloor\right)\\
&amp;\quad-\cdots+(-1)^{n-1}\left({n-1\choose n-1}q+\left\lfloor x_1+x_2+\cdots+x_n\right \rfloor\right)\\
&amp;=g(x_1,x_2,\ldots,x_n)+q\sum_{0\leq k \leq n-1}(-1)^k{n-1\choose k}\\
&amp;=g(x_1,x_2,\ldots,x_n).
\end{align*}
This proves (i). Next we prove (ii). By Proposition \ref{prop} and by (i), we obtain
\begin{align*}
f_{a_1,a_2,\ldots,a_i+qm,\ldots,a_\ell;m}(k)&amp;=(-1)^\ell g\left(\frac{a_1}{m},\frac{a_2}{m},\ldots,\frac{a_i}{m}+q,\ldots,\frac{a_\ell}{m},\frac{k}{m}\right)\\
&amp;\quad+(-1)^{\ell-1} g\left(\frac{a_1}{m},\frac{a_2}{m},\ldots,\frac{a_i}{m}+q,\ldots,\frac{a_\ell}{m}\right)\\
&amp;=(-1)^\ell g\left(\frac{a_1}{m},\frac{a_2}{m},\ldots,\frac{a_\ell}{m},\frac{k}{m}\right)
+(-1)^{\ell-1} g\left(\frac{a_1}{m},\frac{a_2}{m},\ldots,\frac{a_\ell}{m}\right)\\
&amp;=f_{a_1,a_2,\ldots,a_\ell;m}(k).
\end{align*}
Similarly, $f_{a_1,a_2,\ldots,a_\ell;m}(k+qm)=f_{a_1,a_2,\ldots,a_\ell;m}(k)$. This completes the proof.
\end{proof}

\begin{theorem}\label{maintheorem_f}
 For each $\ell\geq2$, $a_1,a_2,\ldots,a_\ell,k\in\mathbb{Z}$ and $m\geq1$, we have  
$$
-2^{\ell-2}\leq f_{a_1,a_2,\ldots,a_\ell;m}(k)\leq 2^{\ell-2}.
$$
Moreover, $-2^{\ell-2}$ and $2^{\ell-2}$ are best possible in the sense that there are $a_1,a_2,\ldots,a_\ell,m,k$ which make the inequality becomes equality. More precisely the following statements hold.
\begin{itemize}
	\item[\rm{(i)}] If $\ell$ is odd, $m$ is even, and $a_i=\frac{m}{2}$ for every $i=1,2,\ldots,\ell$, then $f_{a_1,a_2,\ldots,a_{\ell};m}(0)=-2^{\ell-2}$ and $f_{a_1,a_2,\ldots,a_{\ell};m}(\frac{m}{2})=2^{\ell-2}$.
	\item[\rm{(ii)}] If $\ell$ is even, $m$ is even, and $a_i=\frac{m}{2}$ for every $i=1,2,\ldots,\ell$, then $f_{a_1,a_2,\ldots,a_{\ell};m}(0)=2^{\ell-2}$ and $f_{a_1,a_2,\ldots,a_{\ell};m}(\frac{m}{2})=-2^{\ell-2}$.
\end{itemize} 
\end{theorem}
\begin{proof}
	By Lemma \ref{lem:faqm}, we can assume that $a_i\in[0,m-1]$ for every $1\leq i \leq \ell$.
	Therefore 
	\begin{align}\label{eq:prooff-1}
	\left\lfloor\frac{a_i}{m}\right\rfloor=0 \text{ for every } i\in\{1,2,\ldots,\ell \}.
	\end{align}
	 If $\ell=2$, then the result follows from \eqref{eq:prooff-1} and \eqref{eqxy}, and we have
	\begin{align}\label{eq:f2-1}
	0\leq \left\lfloor\frac{a_1+a_2+k}{m} \right\rfloor-\left\lfloor\frac{a_1+k}{m}\right\rfloor \leq 1,
	\end{align}
	and 
	\begin{align}\label{eq:f2-2}
	-1\leq -\left\lfloor\frac{a_2+k}{m} \right\rfloor+\left\lfloor\frac{k}{m}\right\rfloor \leq 0.
	\end{align}
	Summing \eqref{eq:f2-1} and \eqref{eq:f2-2}, we obtain $-1\leq f_{a_1,a_2;m}(k)\leq1$.
	The result when $\ell\geq3$ is based on a careful selection of pairs and the case $\ell=2$. For illustration purpose, we first give a proof for the case $\ell=3$ and $\ell=4$. Recall that
	\begin{align*}
	f_{a_1,a_2,a_3;m}(k)&amp;=\left\lfloor \frac{a_1+a_2+a_3+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+k}{m} \right\rfloor-\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor-\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor\\
	&amp;\quad+\left\lfloor \frac{a_1+k}{m}\right\rfloor+\left\lfloor \frac{a_2+k}{m}\right\rfloor+\left\lfloor \frac{a_3+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor.
		\end{align*}
		 We obtain by \eqref{eqxy} and \eqref{eq:prooff-1} that
		\begin{equation}\label{proof-fa1-a3-1}
		0\leq\left\lfloor \frac{a_1+a_2+a_3+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+k}{m} \right\rfloor\leq 1,
		\end{equation}
		\begin{equation}\label{proof-fa1-a3-2}
		-1\leq-\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_1+k}{m}\right\rfloor\leq 0,
		\end{equation}
		\begin{equation}\label{proof-fa1-a3-3}
		-1\leq-\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_2+k}{m}\right\rfloor\leq 0,
		\end{equation}
		\begin{equation}\label{proof-fa1-a3-4}
		0\leq\left\lfloor \frac{a_3+k}{m}\right\rfloor-\left\lfloor\frac{k}{m} \right\rfloor\leq 1.
		\end{equation}
		Summing \eqref{proof-fa1-a3-1}, \eqref{proof-fa1-a3-2}, \eqref{proof-fa1-a3-3}, and \eqref{proof-fa1-a3-4}, we see that the middle term is $f_{a_1,a_2,a_3,m}(k)$. Therefore $-2\leq f_{a_1,a_2,a_3;m}(k)\leq2$. Next we consider	
		\begin{align*}
		f_{a_1,a_2,a_3,a_4;m}(k)&amp;=\left\lfloor \frac{a_1+a_2+a_3+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+a_3+k}{m} \right\rfloor-\left\lfloor \frac{a_1+a_2+a_4+k}{m}\right\rfloor\\
		&amp;\quad-\left\lfloor \frac{a_1+a_3+a_4+k}{m}\right\rfloor-\left\lfloor \frac{a_2+a_3+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_1+a_2+k}{m}\right\rfloor\\
		&amp;\quad+\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_1+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_2+a_4+k}{m}\right\rfloor\\
		&amp;\quad+\left\lfloor \frac{a_3+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_1+k}{m}\right\rfloor-\left\lfloor\frac{a_2+k}{m}\right\rfloor-\left\lfloor\frac{a_3+k}{m}\right\rfloor-\left\lfloor\frac{a_4+k}{m}\right\rfloor+\left\lfloor \frac{k}{m}\right\rfloor.
		\end{align*}
		 Again, we obtain by \eqref{eqxy} and \eqref{eq:prooff-1} the following inequalities:
		\begin{equation}\label{proof-fa1-a4-1}
		0\leq\left\lfloor \frac{a_1+a_2+a_3+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+a_3+k}{m} \right\rfloor\leq 1,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-2}
		-1\leq-\left\lfloor \frac{a_1+a_2+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_1+a_2+k}{m}\right\rfloor\leq 0,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-3}
		-1\leq-\left\lfloor \frac{a_1+a_3+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor\leq 0,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-4}
		-1\leq-\left\lfloor \frac{a_2+a_3+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor\leq 0,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-5}
		0\leq\left\lfloor \frac{a_1+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_1+k}{m} \right\rfloor\leq 1,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-6}
		0\leq\left\lfloor \frac{a_2+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_2+k}{m} \right\rfloor\leq 1,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-7}
		0\leq\left\lfloor \frac{a_3+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_3+k}{m} \right\rfloor\leq 1,
		\end{equation}
		\begin{equation}\label{proof-fa1-a4-8}
		-1\leq-\left\lfloor \frac{a_4+k}{m}\right\rfloor+\left\lfloor\frac{k}{m} \right\rfloor\leq 0.
		\end{equation}
		Summing \eqref{proof-fa1-a4-1} to \eqref{proof-fa1-a4-8}, we see that $-4\leq f_{a_1,a_2,a_3,a_4,m}(k)\leq4$.
		
		Next we prove  the general case $\ell\geq5$. The expression of the form $\left\lfloor\frac{a_{i_1}+a_{i_2}+\cdots+a_{i_r}+k}{m} \right \rfloor$ will be called an \emph{$r$-bracket}. So for each $1\leq r \leq \ell$, there are ${\ell \choose r}$ $r$-brackets appearing in the sum defining $f_{a_1,a_2,\ldots,a_\ell;m}(k)$. We follow closely the method used in the proof of Theorem \ref{maintheorem_g}. So we first pair up the $\ell$-bracket with an $(\ell-1)$-bracket as follows:
		\begin{align}\label{eq:proof-f-s1}
		s_1=\left\lfloor \frac{a_1+a_2+\cdots+a_\ell+k}{m}\right\rfloor-\left\lfloor \frac{a_1+a_2+\cdots+a_{\ell-1}+k}{m}\right\rfloor,
		\end{align}
		and we can apply \eqref{eqxy} and \eqref{eq:prooff-1} to obtain the bound for $s_1$. Next we pair up the remaining $(\ell-1)$-brackets with $(\ell-2)$-brackets as follows:
		\begin{align}\label{eq:proof-f-n-1brcket}
		-\left\lfloor \frac{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-1}}+k}{m}\right\rfloor+\left\lfloor \frac{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}}+k}{m}\right\rfloor,
		\end{align}
		and we sum \eqref{eq:proof-f-n-1brcket} over all $1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-1}\leq \ell$ 
		and call it $s_2$.
		Since $a_\ell$ does not appear in the second term on the right hand side of \eqref{eq:proof-f-s1}, the term $a_{i_{\ell-1}}$ appearing in \eqref{eq:proof-f-n-1brcket} is always $a_\ell$. So in fact 
		\begin{align*}
		s_2&amp;=-\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-2}&lt;\ell}\left\lfloor \frac{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}}+a_\ell+k}{m}\right\rfloor\\
		&amp;\quad+\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-2}&lt;\ell}\left\lfloor \frac{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}}+k}{m}\right\rfloor.
		\end{align*}
		We continue doing this process as follows. For each $1\leq r\leq\ell$, let $c_r$ be the sum of all $\left\lfloor\frac{a_{i_1}+a_{i_2}+\cdots+a_{i_r}+k}{m}\right\rfloor$ with $1\leq i_1&lt;i_2&lt;\cdots&lt;i_r\leq \ell$, $a_r$ the sum of all such terms with $i_r=\ell$, and $b_r$ the sum of all such terms with $i_r&lt;\ell$. Therefore $c_r=a_r+b_r$, the number of summands of $c_r$ is ${\ell \choose r}$, the number of summands of $a_r$ is ${\ell-1 \choose r-1}$, and the number of summands of $b_r$ is ${\ell-1 \choose r}$. As usual, the empty sum is defined to be zero, so $b_\ell=0$. We have $s_1=a_\ell-b_{\ell-1}$ and $s_2=-a_{\ell-1}+b_{\ell-2}$. In general, for each $1\leq r \leq \ell-1$, we let 
		\begin{align*}
		s_r=(-1)^{r+1}a_{\ell-r+1}+(-1)^rb_{\ell-r} \text{ and } s_\ell=(-1)^{\ell+1}a_1+(-1)^\ell\left\lfloor\frac{k}{m}\right \rfloor.
		\end{align*}
		Then
		$$0\leq s_r\leq {\ell-1\choose \ell-r} \text{ if $r$ is odd, and }-{\ell-1\choose\ell-r}\leq s_r\leq0 \text{ if $r$ is even},$$
		
		\begin{align*}
		\sum_{1\leq r\leq \ell}s_r&amp;=a_\ell+\sum_{2\leq r\leq\ell-1}(-1)^{r+1}a_{\ell-r+1}+\sum_{1\leq r\leq\ell-2}(-1)^{r}b_{\ell-r}+(-1)^{\ell-1}b_1+s_\ell \\
		&amp;=a_\ell+\sum_{1\leq r\leq\ell-2}(-1)^r(a_{\ell-r}+b_{\ell-r})+(-1)^{\ell-1}b_1+(-1)^{\ell+1}a_1+\left\lfloor\frac{k}{m}\right \rfloor\\
		&amp;=c_\ell+\sum_{1\leq r\leq\ell-2}(-1)^rc_{\ell-r}+(-1)^{\ell-1}c_1+\left\lfloor\frac{k}{m}\right \rfloor\\
		&amp;=\sum_{0\leq r\leq\ell-1}(-1)^rc_{\ell-r}+\left\lfloor\frac{k}{m}\right \rfloor\\
		&amp;=f_{a_1,a_2,\ldots,a_\ell;m}(k).
		\end{align*}
		Therefore
		$$-\sum_{\substack {1\leq r\leq \ell\\r\text{ is even}}}{\ell-1\choose \ell-r}\leq f_{a_1,a_2,\ldots,a_\ell;m}(k)\leq\sum_{\substack {1\leq r\leq \ell\\r\text{ is odd}}}{\ell-1\choose \ell-r}.$$
		Replacing $r$ by $r+1$, we see that
		$$\sum_{\substack {1\leq r\leq \ell\\r\text{ is odd}}}{\ell-1\choose \ell-r}=\sum_{\substack {0\leq r\leq \ell-1\\r\text{ is even}}}{\ell-1\choose \ell-1-r}=2^{\ell-2}.$$
		Similarly, $$-\sum_{\substack {1\leq r\leq \ell\\r\text{ is even}}}{\ell-1\choose \ell-r}=-2^{\ell-2}.$$
		Therefore 
		\begin{align}\label{eq:maxmin-f}
		-2^{\ell-2}\leq f_{a_1,a_2,\ldots,a_\ell;m}(k)\leq2^{\ell-2},
		\end{align}
		as required. If $\ell$ is odd, $m$ is even, and $a_i=\frac{m}{2}$ for every $1\leq i\leq \ell$, we obtain by Proposition \ref{prop} and Theorem \ref{maintheorem_g} that $f_{a_1,a_2,\ldots,a_\ell;m}(0)=g\left(\frac{1}{2},\frac{1}{2},\ldots,\frac{1}{2}\right)=-2^{\ell-2}$and $f_{a_1,a_2,\ldots,a_\ell;m}(\frac{m}{2})=(-1)^{\ell}g\left(\frac{1}{2},\frac{1}{2},\ldots,\frac{1}{2}\right)+(-1)^{\ell-1}g\left(\frac{1}{2},\frac{1}{2},\ldots,\frac{1}{2}\right)=2^{\ell-2}$ . If $\ell$ is even, $m$ is even, and $a_i=\frac{m}{2}$ for every $1\leq i \leq \ell$, we obtain similarly that $f_{a_1,a_2,\ldots,a_\ell;m}(0)=2^{\ell-2}$ and $f_{a_1,a_2,\ldots,a_\ell;m}(\frac{m}{2})=-2^{\ell-2}$. So $2^{\ell-2}$ and $-2^{\ell-2}$ in \eqref{eq:maxmin-f} cannot be improved. This completes The proof.		
\end{proof}

We obtain the extreme values of $S_{a_1,a_2,\ldots,a_\ell;m}$ for some cases $\ell\geq4$ as well. More precisely, we have the following result.

\begin{theorem}\label{neqtheorem9}
	 For each $\ell\geq2$, $a_1,a_2,\ldots,,a_\ell\in\mathbb{Z}$, $m\in\mathbb{N}$, and $K\in\mathbb{N}\cup\{0\}$, we have
	 \begin{equation}\label{abcd}
	 -2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor\leq S_{a_1,a_2,\ldots,a_{\ell};m}(K)\leq2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor.
	 \end{equation}
	Moreover, If $\ell$ is odd, then the lower bound $-2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$ is sharp and if $\ell$ is even, then the upper bound $2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$ is sharp in the sense that there are $a_1,a_2,\ldots,a_\ell,m,k$ which make the inequality becomes equality. More precisely, the following statements hold.
	\begin{itemize}
		\item[\rm{(i)}] If $\ell$ is odd, $m$ is even, and $a_i=\frac{m}{2}$ for every $i=1,2,\ldots,\ell$, then $S_{a_1,a_2,\ldots,a_{\ell};m}(K)=-2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$.
		\item[\rm{(ii)}] If $\ell$ is even, $m$ is even, and $a_i=\frac{m}{2}$ for every $i=1,2,\ldots,\ell$, then $S_{a_1,a_2,\ldots,a_{\ell};m}(K)=2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$.
	\end{itemize}
	
\end{theorem}
\begin{proof}
	If $\ell=2$, then the result is already proved by Jacobsthal \cite{EJ1957}. See also another proof by Tverberg \cite{HT2012}. We recall the result when $\ell=2$ for easy reference as follows:
	\begin{equation}\label{0&lt;S_a,b;m&lt;m/2}
	0\leq S_{a,b;m}(K)\leq \left\lfloor\frac{m}{2}\right\rfloor.
	\end{equation}
	As before the result when $\ell\geq3$ is based on the case $\ell=2$ and a careful selection of pairs, and we first illustrate the idea by giving the proof for the case $\ell=3$ and $\ell=4$. Recall that 
	\begin{align*}
	f_{a_1,a_2,a_3;m}(k)&amp;=\left\lfloor \frac{a_1+a_2+a_3+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+k}{m} \right\rfloor-\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor-\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor\\
	&amp;\quad+\left\lfloor \frac{a_1+k}{m}\right\rfloor+\left\lfloor \frac{a_2+k}{m}\right\rfloor+\left\lfloor \frac{a_3+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor.
	\end{align*}
	We have
	\begin{equation}\label{proof-S3-1}
	f_{a_1+a_2,a_3;m}(k)=\left\lfloor \frac{a_1+a_2+a_3+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+k}{m} \right\rfloor-\left\lfloor \frac{a_3+k}{m}\right\rfloor+\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S3-2}
	-f_{a_1,a_3;m}(k)=-\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_1+k}{m}\right\rfloor+\left\lfloor \frac{a_3+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S3-3}
	-f_{a_2,a_3;m}(k)=-\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_2+k}{m}\right\rfloor+\left\lfloor \frac{a_3+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor.
	\end{equation}
	Summing \eqref{proof-S3-1}, \eqref{proof-S3-2}, and \eqref{proof-S3-3}, we see that
	\begin{equation}\label{proof-S3}
	f_{a_1,a_2,a_3;m}(k)=f_{a_1+a_2,a_3;m}(k)-f_{a_1,a_3;m}(k)-f_{a_2,a_3;m}(k).
	\end{equation}
	By the definition of $S_{a_1,a_2,a_3;m}(K)$, \eqref{proof-S3}, and \eqref{0&lt;S_a,b;m&lt;m/2}, we obtain
	\begin{align*}
	S_{a_1,a_2,a_3;m}(K)&amp;=\sum_{k=0}^{K}f_{a_1,a_2,a_3;m}(k)\\
	&amp;=\sum_{k=0}^{K}f_{a_1+a_2,a_3;m}(k)-\sum_{k=0}^{K}f_{a_1,a_3;m}(k)-\sum_{k=0}^{K}f_{a_2,a_3;m}(k)\\
	&amp;=S_{a_1+a_2,a_3;m}(K)-S_{a_1,a_3;m}(K)-S_{a_2,a_3;m}(K)\\
	&amp;\geq 0-\left\lfloor\frac{m}{2}\right\rfloor-\left\lfloor\frac{m}{2}\right\rfloor
	=-2\left\lfloor\frac{m}{2}\right\rfloor.
	\end{align*}
	Similarly, $$S_{a_1,a_2,a_3;m}(K)\leq\left\lfloor\frac{m}{2}\right\rfloor-0-0=\left\lfloor\frac{m}{2}\right\rfloor\leq 2\left\lfloor\frac{m}{2}\right\rfloor.$$
	Similarly, we have the following equalities:
	\begin{equation}\label{proof-S4-1}
	f_{a_1+a_2+a_3,a_4;m}(k)=\left\lfloor \frac{a_1+a_2+a_3+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_1+a_2+a_3+k}{m} \right\rfloor-\left\lfloor \frac{a_4+k}{m}\right\rfloor+\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S4-2}
	-f_{a_1+a_2,a_4;m}(k)=-\left\lfloor \frac{a_1+a_2+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_1+a_2+k}{m}\right\rfloor+\left\lfloor \frac{a_4+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S4-3}
	-f_{a_1+a_3,a_4;m}(k)=-\left\lfloor \frac{a_1+a_3+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_1+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_4+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S4-4}
	-f_{a_2+a_3,a_4;m}(k)=-\left\lfloor \frac{a_2+a_3+a_4+k}{m}\right\rfloor+\left\lfloor \frac{a_2+a_3+k}{m}\right\rfloor+\left\lfloor \frac{a_4+k}{m}\right\rfloor-\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S4-5}
	f_{a_1,a_4;m}(k)=\left\lfloor \frac{a_1+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_1+k}{m} \right\rfloor-\left\lfloor \frac{a_4+k}{m}\right\rfloor+\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S4-6}
	f_{a_2,a_4;m}(k)=\left\lfloor \frac{a_2+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_2+k}{m} \right\rfloor-\left\lfloor \frac{a_4+k}{m}\right\rfloor+\left\lfloor \frac{k}{m}\right\rfloor,
	\end{equation}
	\begin{equation}\label{proof-S4-7}
	f_{a_3,a_4;m}(k)=\left\lfloor \frac{a_3+a_4+k}{m}\right\rfloor-\left\lfloor\frac{a_3+k}{m} \right\rfloor-\left\lfloor \frac{a_4+k}{m}\right\rfloor+\left\lfloor \frac{k}{m}\right\rfloor.
	\end{equation}
	Summing \eqref{proof-S4-1} to \eqref{proof-S4-7} and recalling the definition of $f_{a_1,a_2,a_3,a_4;m}(k)$, we see that
	\begin{align}\label{proof-S4}
	f_{a_1,a_2,a_3,a_4;m}(k)&amp;=f_{a_1+a_2+a_3,a_4;m}(k)-f_{a_1+a_2,a_4;m}(k)-f_{a_1+a_3,a_4;m}(k)-f_{a_2+a_3,a_4;m}(k)\notag \\
	&amp;\quad+f_{a_1,a_4;m}(k)+f_{a_2,a_4;m}(k)+f_{a_3,a_4;m}(k).
	\end{align}
	Then we obtain from \eqref{proof-S4} and \eqref{0&lt;S_a,b;m&lt;m/2} that
	\begin{align*}
	S_{a_1,a_2,a_3,a_4;m}(K)&amp;=S_{a_1+a_2+a_3,a_4;m}(K)-S_{a_1+a_2,a_4;m}(K)-S_{a_1+a_3,a_4;m}(K)-S_{a_2+a_3,a_4;m}(K)\\
	&amp;\quad+S_{a_1,a_4;m}(K)+S_{a_2,a_4;m}(K)+S_{a_3,a_4;m}(K)\\
	&amp;\leq \left\lfloor\frac{m}{2}\right\rfloor-0-0-0+\left\lfloor\frac{m}{2}\right\rfloor+\left\lfloor\frac{m}{2}\right\rfloor+\left\lfloor\frac{m}{2}\right\rfloor=4\left\lfloor\frac{m}{2}\right\rfloor.
	\end{align*}
	Similarly, $S_{a_1,a_2,a_3,a_4;m}(K)\geq-4\left\lfloor \frac{m}{2}\right\rfloor$.
	Next we prove the general case $\ell\geq5$. The expression of the form $\left\lfloor\frac{a_{i_1}+a_{i_2}+\cdots+a_{i_r}+k}{m} \right \rfloor$ will be called an \emph{$r$-bracket}. So for each $0\leq r \leq \ell$, there are ${\ell \choose r}$ $r$-brackets appearing in the sum defining $f_{a_1,a_2,\ldots,a_\ell;m}(k)$. We first pair up the $\ell$-bracket with an $(\ell-1)$-bracket, a $1$-bracket and a $0$-bracket as follows:
	\begin{equation}\label{proof-S-s1}
	s_1(k)=\left\lfloor\frac{a_1+a_2+\cdots+a_\ell+k}{m} \right \rfloor-\left\lfloor\frac{a_1+a_2+\cdots+a_{\ell-1}+k}{m} \right \rfloor
	-\left\lfloor\frac{a_\ell+k}{m} \right \rfloor+\left\lfloor\frac{k}{m} \right \rfloor.
	\end{equation}
	So $s_1(k)$ is in fact $f_{a_1+a_2+\cdots+a_{\ell-1},a_\ell;m}(k)$
	and we can apply \eqref{0&lt;S_a,b;m&lt;m/2} to obtain the inequality 
	$$
	0\leq S_{a_1+a_2+\cdots+a_{\ell-1},a_\ell;m}(K)=\sum_{k=0}^{K}s_1(k)\leq \left\lfloor\frac{m}{2}\right\rfloor.
	$$
	Next we pair up the remaining $(\ell-1)$-brackets with $(\ell-2)$-brackets, $1$-brackets and $0$-brackets as follows:
	\begin{equation}\label{proof-S-s1-2}
	-\left\lfloor\frac{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-1}}+k}{m} \right \rfloor+\left\lfloor\frac{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}}+k}{m} \right \rfloor
	+\left\lfloor\frac{a_{i_{\ell-1}}+k}{m} \right \rfloor-\left\lfloor\frac{k}{m} \right \rfloor,
	\end{equation}
	and we sum \eqref{proof-S-s1-2} over all $1\leq i_1&lt;i_2&lt;\cdots&lt;i_{\ell-1}\leq\ell$ and call it $s_2(k)$. Since $a_\ell$ does not appear in the second term on the right hand side of \eqref{proof-S-s1}, the term $a_{i_{\ell-1}}$ appearing in \eqref{proof-S-s1-2} is always $a_\ell$. So in fact \eqref{proof-S-s1-2} is $-f_{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}},a_\ell;m}(k)$ and
	\begin{align*}
	s_2(k)=-\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-2}&lt;\ell}f_{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}},a_\ell;m}(k)
	\end{align*}
	Furthermore, 
	\begin{align*}
	\sum_{k=0}^{K}s_2(k)=-\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-2}&lt;\ell}S_{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-2}},a_\ell;m}(K)\leq0,
	\end{align*}
	where the last inequality is obtained from \eqref{0&lt;S_a,b;m&lt;m/2}.
	We continue doing this process and follow closely the method used in the proof of Theorems \ref{maintheorem_g} and \ref{maintheorem_f}. The well-known identities previously recalled will be applied without reference. For each $1\leq r \leq \ell$, let $c_r(k)$ be the sum of all $\left\lfloor\frac{a_{i_1}+a_{i_2}+\cdots+a_{i_r}+k}{m}\right\rfloor$ with $1\leq i_1&lt;i_2&lt;\cdots&lt;i_r\leq \ell$, $a_r(k)$ the sum of all such terms with $i_r=\ell$, and $b_r(k)$ the sum of all such terms with $i_r&lt;\ell$. Therefore $c_r(k)=a_r(k)+b_r(k)$, the number of $r$-brackets appearing in the sum defining $c_r(k)$ is ${\ell \choose r}$, the number of $r$-brackets appearing in the sum defining $a_r(k)$ is ${\ell-1 \choose r-1}$, and the number of $r$-brackets appearing in the sum defining $b_r(k)$ is ${\ell-1 \choose r}$. As usual, the empty sum is defined to be zero, so $b_\ell(k)=0$. We have $s_1(k)=a_\ell(k)-b_{\ell-1}(k)-a_1(k)+\left\lfloor\frac{k}{m} \right \rfloor$ and $s_2(k)=-a_{\ell-1}(k)+b_{\ell-2}(k)+{\ell-1\choose \ell-2}a_1(k)-{\ell-1\choose \ell-2}\left\lfloor\frac{k}{m} \right \rfloor$. In general, for each $1\leq r \leq \ell-1$, we let 
	\begin{align*}
	s_r(k)&amp;=(-1)^{r+1}a_{\ell-r+1}(k)+(-1)^rb_{\ell-r}(k)+(-1)^r{\ell-1\choose \ell-r}a_1(k)+(-1)^{r+1}{\ell-1\choose \ell-r}\left\lfloor\frac{k}{m} \right \rfloor\\
	&amp;=(-1)^{r+1}\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-r}&lt;\ell}f_{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-r}},a_\ell;m}(k).
	\end{align*}
	Then $$\sum_{k=0}^{K}s_r(k)=(-1)^{r+1}\sum_{1\leq i_1&lt;i_2&lt;\ldots&lt;i_{\ell-r}&lt;\ell}S_{a_{i_1}+a_{i_2}+\cdots+a_{i_{\ell-r}},a_\ell;m}(K).$$
	So by \eqref{0&lt;S_a,b;m&lt;m/2}, we see that
	$$0\leq \sum_{k=0}^{K}s_r(k)\leq {\ell-1\choose \ell-r}\left\lfloor\frac{m}{2} \right \rfloor \text{ if $r$ is odd, and }-{\ell-1\choose\ell-r}\left\lfloor\frac{m}{2} \right \rfloor\leq \sum_{k=0}^{K}s_r(k)\leq0 \text{ if $r$ is even}.$$
	Similar to the proof of Theorems \ref{maintheorem_g} and \ref{maintheorem_f}, we obtain
	\begin{align*}
	\sum_{1\leq r\leq \ell-1}s_r(k)
	&amp;=a_\ell+\sum_{2\leq r\leq\ell-1}(-1)^{r+1}a_{\ell-r+1}+\sum_{1\leq r\leq\ell-2}(-1)^{r}b_{\ell-r}+(-1)^{\ell-1}b_1\\
	&amp;\quad+(-1)^{\ell+1}a_1+(-1)^\ell\left\lfloor\frac{k}{m} \right \rfloor \\
	&amp;=a_\ell+\sum_{1\leq r\leq\ell-2}(-1)^r(a_{\ell-r}+b_{\ell-r})+(-1)^{\ell-1}b_1+(-1)^{\ell+1}a_1+(-1)^\ell\left\lfloor\frac{k}{m}\right \rfloor\\
	&amp;=c_\ell+\sum_{1\leq r\leq\ell-2}(-1)^rc_{\ell-r}+(-1)^{\ell-1}c_1+(-1)^\ell\left\lfloor\frac{k}{m}\right \rfloor\\
	&amp;=\sum_{0\leq r\leq\ell-1}(-1)^rc_{\ell-r}+(-1)^\ell\left\lfloor\frac{k}{m}\right \rfloor\\
	&amp;=f_{a_1,a_2,\ldots,a_\ell;m}(k).
	\end{align*}
	Therefore
	\begin{equation}\label{-sum&lt;S&lt;sum}
	-\sum_{\substack {1\leq r\leq \ell-1\\r\text{ is even}}}{\ell-1\choose \ell-r}\left\lfloor\frac{m}{2} \right \rfloor\leq \sum_{k=0}^{K}f_{a_1,a_2,\ldots,a_\ell;m}(k)\leq\sum_{\substack {1\leq r\leq \ell-1\\r\text{ is odd}}}{\ell-1\choose \ell-r}\left\lfloor\frac{m}{2} \right \rfloor.
	\end{equation}
	The middle term in \eqref{-sum&lt;S&lt;sum} is $S_{a_1,a_2,\ldots,a_\ell;m}(K)$. The left and right most terms in \eqref{-sum&lt;S&lt;sum} are, respectively, equal to $-2^{\ell-2}\left\lfloor\frac{m}{2} \right \rfloor$ and $2^{\ell-2}\left\lfloor\frac{m}{2} \right \rfloor$ which can be evaluated by the well-known identity previously recalled. 
	This proves the first part of the theorem. Next we show that one of the upper bound or lower bound is sharp. Let $C=\{a_1,a_2,\ldots,a_{\ell}\}$.
	Suppose $\ell$ is odd, $m$ is even, and $a_i=\frac{m}{2}$ for every $1\leq i\leq \ell$. Then we obtain by Proposition \ref{prop} and Theorem \ref{maintheorem_g} that $f_{C;m}(0)=g\left(\frac{1}{2},\frac{1}{2},\ldots,\frac{1}{2}\right)=-2^{\ell-2}$.
	Let $0&lt;k&lt; \frac{m}{2}$. By the definition of $f_{C;m}(k)$, we see that 
	\begin{align}
	f_{C;m}(k)&amp;=\sum_{T\subseteq[1,\ell]}(-1)^{\ell-|T|}\left\lfloor\frac{k}{m}+\frac{|T|}{2} \right\rfloor\notag\\
	&amp;=\sum_{r=0}^{\ell}(-1)^{\ell-r}{\ell \choose r}\left\lfloor\frac{k}{m}+\frac{r}{2} \right\rfloor
	\end{align}
	Since $0&lt;k&lt;\frac{m}{2}$, we have $\frac{r}{2}&lt;\frac{k}{m}+\frac{r}{2}&lt;\frac{r+1}{2}$. So if $r$ is even, then $\left\lfloor\frac{k}{m}+\frac{r}{2} \right\rfloor=\frac{r}{2}=\left\lfloor\frac{r}{2} \right\rfloor$ and if $r$ is odd, then $\left\lfloor\frac{k}{m}+\frac{r}{2} \right\rfloor=\frac{r-1}{2}=\left\lfloor\frac{r}{2} \right\rfloor$. In any case, $\left\lfloor\frac{k}{m}+\frac{r}{2} \right\rfloor=\frac{r}{2}=\left\lfloor\frac{0}{m}+\frac{r}{2} \right\rfloor$. This implies that $f_{C;m}(k)=f_{C;m}(0)$ for every $k=0,1,2,\ldots,\frac{m}{2}-1$.
	Then
	$$S_{C;m}\left(\frac{m}{2}-1\right)=\sum_{k=0}^{\frac{m}{2}-1}f_{C;m}(k)=\frac{m}{2} f_{C;m}(0)=-2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$$
	 So $-2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$ in \eqref{abcd} cannot be improved when $\ell$ is odd. Next suppose $\ell$ is even, $m$ is even, and $a_i=\frac{m}{2}$ for every $1\leq i \leq \ell$. Then we obtain similarly that $f_{C;m}(k)=f_{C;m}(0)=2^{\ell-2}$ for every $k=0,1,2,\ldots,\frac{m}{2}-1$.
	  Then
	 $S_{C;m}(\frac{m}{2}-1)=2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor.$
	  So $2^{\ell-2}\left\lfloor\frac{m}{2}\right\rfloor$ in \eqref{abcd} cannot be improved when $\ell$ is even. This completes the proof.
	
\end{proof}
\section{Acknowledgments}
Kritkhajohn Onphaeng wishes to thank DPST (Development and Promotion of Science and Technology Talents) for giving him a scholarship. 
Prapanpong Pongsriiam receives financial support jointly from The
Thailand Research Fund and Faculty of Science, Silpakorn University,
grant number RSA5980040.  Correspondence should be addressed to
Prapanpong Pongsriiam: \href{mailto:prapanpong@gmail.com}{\tt prapanpong@gmail.com} .

\begin{thebibliography}{9}
	
	\bibitem{LC1959} L. Carlitz, An arithmetic sum connected with the greatest integer function, {\it Norske Vid. Selsk. Forh. Trondheim} {\bf 32} (1959), 24--30.
	
	\bibitem{LC1960} L. Carlitz, Some arithmetic sums connected with the greatest integer function, {\it Math Scand.} {\bf 8} (1960), 59--64.
	
	\bibitem{RG1974} R. C. Grimson, The evaluation of a sum of Jacobsthal, {\it Norske Vid. Selsk. Skr. Trondheim} (1974), No.~4.
	
	\bibitem{EJ1957} E. Jacobsthal, \"{U}ber eine zahlentheoretische Summe, {\it Norske Vid. Selsk. Forh. Trondheim} {\bf 30} (1957), 35--41.
	
	
	\bibitem{OE} N. J. A. Sloane, The On-Line Encyclopedia of Integer Sequences, \url{https://oeis.org}.
	
	\bibitem{HT2012} H. Tverberg, On some number-theoretic sums introduced by Jacobsthal, {\it Acta Arith.} {\bf 155} (2012), 349--351.
\end{thebibliography}
\bigskip
\hrule
\bigskip

\noindent 2010 {\it Mathematics Subject Classification}:
Primary 11A25; Secondary 11B37.

\noindent \emph{Keywords: }
Jacobsthal sum, Jacobsthal number, Jacobsthal-Lucas number, floor
function, sum.

\bigskip
\hrule
\bigskip

\noindent (Concerned with sequences \seqnum{A001045} and \seqnum{A014551}.)




\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received September 28 2016;
revised version received January 4 2017.
Published in {\it Journal of Integer Sequences}, January 14 2017.

\bigskip
\hrule
\bigskip

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

\end{document}
</pre></body></html>