\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}{-.5in}
\setlength{\textheight}{8.9in}

\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}

\def\C{{\mathbb{C}}}
\def\R{{\mathbb{R}}}
\def\N{{\mathbb{N}}}
\def\Z{{\mathbb{Z}}}
\def\1{{\bf 1}}

\def\id{\operatorname{id}}
\def\lcm{\operatorname{lcm}}

\def\altern{\operatorname{altern}}
\def\DFT{\operatorname{DFT}}
\def\bino{\operatorname{binom}}
\def\logo{\operatorname{log}}
\def\Gammo{\operatorname{Gamma}}
\def\flooro{\operatorname{floor}}
\def\sawo{\operatorname{saw-tooth}}
\def\sino{\operatorname{sin}}
\def\coto{\operatorname{cot}}


\newcommand{\DOT}{\text{\rm\Huge{.}}}


\begin{center}
\vskip 1cm{\LARGE\bf Weighted Gcd-Sum Functions} \vskip 1cm \large
L\'aszl\'o T\'oth \footnote{The author gratefully acknowledges
support from the Austrian Science
Fund (FWF) under the project Nr. P20847-N18.} \\
Department of Mathematics \\
University of P\'ecs \\
Ifj\'us\'ag u. 6 \\
7624 P\'ecs \\
Hungary \\ and \\ Institute of Mathematics, Department of Integrative Biology \\
Universit\"at f\"ur Bodenkultur \\ Gregor Mendel-Stra{\ss}e 33 \\
A-1180 Wien \\ Austria \\
\href{mailto:ltoth@gamma.ttk.pte.hu}{\tt ltoth@gamma.ttk.pte.hu}\\
\end{center}

\vskip .2 in

\begin{abstract} 
We investigate weighted gcd-sum functions, including
the alternating gcd-sum function and those having as weights the
binomial coefficients and values of the Gamma function. We also
consider the alternating lcm-sum function.
\end{abstract}

%************************* section 1 *******************************************

\section{Introduction}

The gcd-sum function, called also Pillai's arithmetical function
(OEIS \seqnum{A018804}) is defined by
\begin{equation} \label{gcd_def}
P(n):= \sum_{k=1}^n \gcd(k,n) \qquad (n\in \N:=\{1,2,\ldots \}).
\end{equation}

The function $P$ is multiplicative and its arithmetical and
analytical properties are determined by the representation
\begin{equation} \label{gcd_convo}
P(n)= \sum_{d\mid n} d\, \phi(n/d) \qquad (n\in \N),
\end{equation}
where $\phi$ is Euler's function. See the survey paper
\cite{Tot2010}. Note that for every prime power $p^a$ ($a\in \N$),
\begin{equation} \label{P_prime_power}
P(p^a)=(a+1)p^a-ap^{a-1}.
\end{equation}

Now let
\begin{equation} \label{gcd_altern_def}
P_{\altern}(n):= \sum_{k=1}^n (-1)^{k-1} \gcd(k,n) \qquad (n\in \N)
\end{equation}
be the alternating gcd-sum function. As far as we know, the function
\eqref{gcd_altern_def} was not considered before.

Furthermore, let
\begin{equation} \label{gcd_binom_def}
P_{\bino}(n):= \sum_{k=1}^n  \binom{n}{k} \gcd(k,n) \qquad (n\in \N)
\end{equation}
(OEIS \seqnum{A159068}), where $\binom{n}{k}$ are the binomial
coefficients. Every term of the sum \eqref{gcd_binom_def} is a
multiple of $n$, since $\gcd(k,n)=kx+ny$ with suitable integers
$x,y$ and $k\binom{n}{k}=n\binom{n-1}{k-1}$ ($1\le k\le n$). Note
also the symmetry $\binom{n}{k} \gcd(k,n)= \binom{n}{n-k}
\gcd(n-k,n)$ ($1\le k\le n-1$).

More generally, consider the weighted gcd-sum functions defined by
\begin{equation} \label{gcd_weight_def}
P_w(n):= \sum_{k=1}^n w(k,n) \gcd(k,n) \qquad (n\in \N),
\end{equation}
where the weights are functions $w:\N^2 \to \C$.

In this paper we evaluate the alternating gcd-sum function
$P_{\altern}(n)$, deduce a formula for the function $P_{\bino}(n)$
and investigate other special cases of \eqref{gcd_weight_def}. We
also give a formula for the alternating lcm-sum function defined by
\begin{equation} \label{lcm_altern_def}
L_{\altern}(n):= \sum_{k=1}^n (-1)^{k-1} \lcm[k,n] \qquad (n\in \N).
\end{equation}

Similar results can be derived for the weighted versions of certain
analogs and generalizations of the gcd-sum function, see
\cite{Tot2010}, but we confine ourselves to the function
\eqref{gcd_weight_def}.

%************************* section 2 *******************************************

\section{General results}

We first give the following simple result.

\begin{proposition} \label{prop_general} i) Let $w:\N^2 \to \C$ be an arbitrary function. Then
\begin{equation} \label{gcd_weight_repr}
P_w(n)=\sum_{d\mid n} \phi(d) \sum_{j=1}^{n/d} w(dj,n) \qquad (n\in
\N).
\end{equation}

ii) Assume that there is a function $g:(0,1] \to \C$ such that
$w(k,n)=g(k/n)$ ($1\le k\le n$) and let $G(n)=\sum_{k=1}^n g(k/n)$
($n\in \N$). Then
\begin{equation} \label{gcd_weight_repr_g}
P_w(n)=\sum_{d\mid n} \phi(d) G(n/d) \qquad (n\in \N).
\end{equation}
\end{proposition}

\begin{proof} i) Using Gauss' formula $m=\sum_{d\mid m} \phi(d)$ for
$m=\gcd(k,n)$, grouping the terms of \eqref{gcd_weight_def} and
denoting $k=dj$ we obtain at once
\begin{equation*}
P_w(n):= \sum_{k=1}^n w(k,n) \sum_{d\mid \gcd(k,n)} \phi(d)=
\sum_{d\mid n} \phi(d) \sum_{j=1}^{n/d} w(dj,n).
\end{equation*}

ii) Use \eqref{gcd_weight_repr} and that
\begin{equation*}
\sum_{j=1}^{n/d} w(dj,n)= \sum_{j=1}^{n/d} g(dj/n)= \sum_{j=1}^{n/d}
g(j/(n/d))= G(n/d).
\end{equation*}
\end{proof}

For $w(k,n)=1$ we reobtain formula formula \eqref{gcd_convo}. In the
next section we investigate other special cases, including those
already mentioned in the Introduction.

\begin{remark} {\rm Consider the function
\begin{equation} \label{rel_prime_def}
R_w(n):= \sum_{\substack{k=1\\ \gcd(k,n)=1}}^n w(k,n) \qquad (n\in
\N).
\end{equation}

Then, similar to the proof of i), now with the M\"obius $\mu$
function instead of $\phi$,
\begin{equation} \label{rel_prime_repr}
R_w(n)= \sum_{k=1}^n w(k,n) \sum_{d\mid \gcd(k,n)} \mu(d)=
\sum_{d\mid n} \mu(d) \sum_{j=1}^{n/d} w(dj,n).
\end{equation}

If condition ii) is satisfied, then we have
\begin{equation} \label{rel_prime_repr_g}
R_w(n)=\sum_{d\mid n} \mu(d) G(n/d) \qquad (n\in \N).
\end{equation}

We will also point out some special cases of \eqref{rel_prime_repr}
and \eqref{rel_prime_repr_g}.}
\end{remark}

%************************* section 3 *******************************************

\section{Special cases}

\subsection{Alternating gcd-sum function}

Let $w(k,n)=(-1)^{k-1}$ ($k,n\in \N$). Then we have the function
$P_{\altern}(n)$ defined by \eqref{gcd_altern_def}.

\begin{proposition} \label{prop_gcd_altern} Let $n\in \N$ and write $n=2^am$,
where $a\in \N_0:=\{0,1,2,\ldots\}$ and $m\in \N$ is odd. Then
\begin{equation} \label{gcd_altern_repr}
P_{\altern}(n)= \begin{cases} n, & \text{ if $n$ is odd ($a=0$)};
\\ -2^{a-1}aP(m) = -\frac{a}{a+2}P(n), & \text{ if $n$ is even ($a\ge 1$)}. \end{cases}
\end{equation}
\end{proposition}

\begin{proof} Use formula \eqref{gcd_weight_repr}. Here
\begin{equation*}
S_d(n):= \sum_{j=1}^{n/d} w(dj,n)= \sum_{j=1}^{n/d} (-1)^{dj-1}= -
\sum_{j=1}^{n/d} (-1)^{dj}.
\end{equation*}

If $n$ is odd, then every divisor $d$ of $n$ is also odd and obtain
$S_d(n)= - \sum_{j=1}^{n/d} (-1)^j= 1$, where $n/d$ is odd. Hence,
$P_{\altern}(n)=\sum_{d\mid n} \phi(d)=n$.

Now let $n$ be even and let $d\mid n$. For $d$ odd, $S_d(n)= -
\sum_{j=1}^{n/d} (-1)^j=0$, since $n/d$ is even. For $d$ even,
$S_d(n)=- \sum_{j=1}^{n/d} 1 = - n/d$. We obtain that
\begin{equation*}
P_{\altern}(n)=  - \sum_{\substack{d\mid n\\ \text{ $d$ even}} }
\phi(d) \frac{n}{d} = - \sum_{d\mid n} \phi(d) \frac{n}{d} +
\sum_{\substack{d\mid n\\ \text{ $d$ odd}}} \phi(d) \frac{n}{d},
\end{equation*}
where the first sum is $P(n)$ (cf. \eqref{gcd_convo}), and the
second one is
\begin{equation*}
\sum_{d\mid m} \phi(d) \frac{2^a m}{d}=2^aP(m).
\end{equation*}

Using \eqref{P_prime_power}, $P(n)=P(2^a)P(m)=2^{a-1}(a+2)P(m)$ and
deduce
\begin{equation*}
P_{\altern}(n)= - P(n) + 2^aP(m)= P(m)(2^a-2^{a-1}(a+2))
\end{equation*}
\begin{equation*}
= -2^{a-1}aP(m)= -\frac{a}{a+2}P(n).
\end{equation*}
\end{proof}

\begin{remark} {\rm More generally, consider the polynomial
\begin{equation}
f_n(x):= \sum_{k=1}^n \gcd(k,n) x^{k-1},
\end{equation}
i.e., put $w(k,n)=x^{k-1}$ (formally). Then $f_n(1)= P(n)$,
$f_n(-1)= P_{\altern}(n)$ and deduce from Proposition
\ref{prop_general},
\begin{equation}
f_n(x):=  \left(1- x^n\right) \sum_{d\mid n}
\frac{\phi(d)x^{d-1}}{1-x^d}.
\end{equation}}
\end{remark}

\subsection{Logarithms as weights}

Let
\begin{equation} \label{gcd_log_def}
P_{\logo}(n):= \sum_{k=1}^n  (\log k) \gcd(k,n).
\end{equation}

\begin{proposition} For every $n\in \N$,
\begin{equation} \label{gcd_log_repr}
P_{\logo}(n)= P(n)\log n + \sum_{d\mid n} \log (d!/d^d) \phi(n/d).
\end{equation}
\end{proposition}

\begin{proof} Apply formula \eqref{gcd_weight_repr}. For
$w(k,n)=\log k$,
\begin{equation*}
\sum_{j=1}^{n/d} w(dj,n)= \sum_{j=1}^{n/d} \log (dj)=
\frac{n}{d}\log d + \log \left(\frac{n}{d}\right)!,
\end{equation*}
hence
\begin{equation*}
P_{\logo}(n)= \sum_{d\mid n} \phi(d) \left(\frac{n}{d}\log d + \log
\left(\frac{n}{d}\right)!\right),
\end{equation*}
and a short computation leads to \eqref{gcd_log_repr}.
\end{proof}

\begin{remark} {\rm Writing the exponential form of \eqref{gcd_log_repr},
\begin{equation} \label{prod_gcd}
\prod_{k=1}^n k^{\gcd(k,n)}= n^{P(n)} \prod_{d\mid n}
\left(\frac{d!}{d^d}\right)^{\phi(n/d)}.
\end{equation}

Compare this to the known formula
\begin{equation}
\prod_{\substack{k=1\\ \gcd(k,n)=1}}^n k = n^{\phi(n)} \prod_{d\mid
n} \left(\frac{d!}{d^d}\right)^{\mu(n/d)},
\end{equation}
cf. \cite[p.\ 197, Ex.\ 24]{NZM} (OEIS \seqnum{A001783}).}
\end{remark}

\subsection{Discrete Fourier transform of the gcd's}

Consider $w(k,n)=\exp(2\pi ikr/n)$ ($k,n\in \N$), where $r\in \Z$,
and denote
\begin{equation} \label{gcd_DFT_def}
P^{(r)}_{\DFT}(n):= \sum_{k=1}^n  \exp(2\pi ikr/n) \gcd(k,n),
\end{equation}
representing the discrete Fourier transform of the function
$f(k)=\gcd(k,n)$ ($k\in \N$).

\begin{proposition} For every $n\in \N$, $r\in \Z$,
\begin{equation} \label{gcd_DFT_repr}
P^{(r)}_{\DFT}(n)= \sum_{d\mid \gcd(n,r)} d\, \phi(n/d).
\end{equation}
\end{proposition}

\begin{proof} Here $\exp(2\pi ikr/n)= g(k/n)$ with $g(x)=\exp(2\pi irx)$.
Using formula \eqref{gcd_weight_repr_g} and that
\begin{equation*}
\sum_{k=1}^n \exp(2\pi irk/n)= \begin{cases} n, & \text{ if $n\mid
r$}; \\ 0, & \text{ otherwise}; \end{cases}
\end{equation*}
we obtain
\begin{equation*}
P^{(r)}_{\DFT}(n)= \sum_{d\mid n, n/d\mid r } \phi(d) \frac{n}{d}=
\sum_{d\mid n, d\mid r} d\phi(n/d).
\end{equation*}
\end{proof}

\begin{remark} {\rm  Formula \eqref{gcd_DFT_repr} can be written in the form
\begin{equation} \label{gcd_DFT_repr_Raman}
P^{(r)}_{\DFT}(n)= \sum_{d\mid n} d c_{n/d}(r),
\end{equation}
where $c_n(k)$ are the Ramanujan sums. Furthermore,
\eqref{gcd_DFT_repr_Raman} can be  extended for $r$-even functions.
See \cite{Sch2008}, \cite[Prop.\ 2]{TotHau}. Note that in the
present treatment we do not need properties of the Ramanujan sums
and of $r$-even functions.}
\end{remark}

For $r=0$ (more generally, in case $n\mid r$) we reobtain from
\eqref{gcd_DFT_repr} formula \eqref{gcd_convo}. For $r=1$ we deduce
\begin{equation} \label{exp_Euler}
\sum_{k=1}^n  \exp(2\pi ik/n) \gcd(k,n)= \phi(n) \qquad (n\in \N),
\end{equation}
which gives by writing the real and the imaginary parts,
respectively,
\begin{equation} \label{cos_Euler}
\sum_{k=1}^n  \cos (2\pi k/n) \gcd(k,n)= \phi(n) \qquad (n\in \N),
\end{equation}
\begin{equation} \label{sin_0}
\sum_{k=1}^n  \sin(2\pi k/n) \gcd(k,n)= 0 \qquad (n\in \N),
\end{equation}
similar relations being valid for $\gcd(n,r)=1$.

Formulae \eqref{exp_Euler}, \eqref{cos_Euler}, \eqref{sin_0} were
pointed out in \cite[Ex.\ 3]{Sch2008}.

\subsection{Binomial coefficients as weights}

Let $w(k,n)=\binom{n}{k}$ ($k,n\in \N$). Then we have the function
$P_{\bino}(n)$ defined by \eqref{gcd_binom_def}.

\begin{proposition} For every $n\in \N$,
\begin{equation} \label{gcd_binom_repr}
P_{\bino}(n)= 2^n \sum_{d\mid n} \frac{\phi(d)}{d} \sum_{\ell=1}^d
(-1)^{\ell} \cos^n (\ell\pi/d) -n.
\end{equation}
\end{proposition}

\begin{proof} Let $\varepsilon_r^j=\exp(2\pi ij/r)$ ($1\le j\le r$) denote the $r$-th roots of unity.
Using the known identity
\begin{equation} \label{binom_id}
\sum_{k=0}^{\lfloor n/r \rfloor}  \binom{n}{kr} = \frac1{r}
\sum_{j=1}^r (1+\varepsilon_r^j)^n = \frac{2^n}{r} \sum_{j=1}^r
\cos^n (j\pi/r) \cos (nj\pi/r) \qquad (n,r\in \N),
\end{equation}
cf. \cite[p.\ 84]{Com1974}, and applying \eqref{gcd_weight_repr} we
deduce
\begin{equation*}
P_{\bino}(n)=\sum_{d\mid n} \phi(d) \sum_{j=1}^{n/d} \binom{n}{dj}=
\sum_{d\mid n} \phi(d) \left( \frac{2^n}{d} \sum_{\ell=1}^d \cos^n
(\ell\pi/d) \cos (n\ell\pi/d) -1\right)
\end{equation*}
\begin{equation*}
= 2^n \sum_{d\mid n} \frac{\phi(d)}{d} \sum_{\ell=1}^d (-1)^{\ell}
\cos^n (\ell\pi/d) - \sum_{d\mid n} \phi(d),
\end{equation*}
giving \eqref{gcd_binom_repr}.
\end{proof}

Note that \eqref{rel_prime_repr} and \eqref{binom_id} lead to the
following formula for the sequence OEIS \seqnum{A056188}:
\begin{equation} \label{rel_prime_binom_repr}
R_{\bino}(n):= \sum_{\substack{k=1\\ \gcd(k,n)=1}}^n \binom{n}{k}=
2^n \sum_{d\mid n} \frac{\mu(d)}{d} \sum_{\ell=1}^d (-1)^{\ell}
\cos^n (\ell\pi/d) \qquad (n>1).
\end{equation}

\subsection{Weights concerning the Gamma function}

Now let
\begin{equation} \label{gcd_gamma_def}
P_{\Gammo}(n):= \sum_{k=1}^n  \log \Gamma \left(\frac{k}{n} \right)
\gcd(k,n),
\end{equation}
where $\Gamma$ is the Gamma function.

\begin{proposition} For every $n\in \N$,
\begin{equation} \label{gcd_gamma_repr}
P_{\Gammo}(n)= \frac{\log 2\pi}{2} \left(P(n)-n\right)
-\frac1{2}n\log n +\frac1{2} \sum_{d\mid n} \phi(d)\log d.
\end{equation}
\end{proposition}

\begin{proof} This follows by \eqref{gcd_weight_repr_g} and by
\begin{equation*}
\prod_{k=1}^n \Gamma \left(\frac{k}{n} \right) =(2\pi)^{(n-1)/2}
n^{-1/2}, \qquad (n\in \N),
\end{equation*}
which is a consequence of Gauss' multiplication formula.
\end{proof}

\begin{remark} {\rm \eqref{gcd_gamma_repr} can be written also as
\begin{equation}
P_{\Gammo}(n)= \frac{\log 2\pi}{2} \left(P(n)-n\right) -\frac1{2}
(\phi * \log)(n),
\end{equation}
where $*$ deotes the Dirichlet convolution. Note that $\phi *
\log=\mu *\id *\log = \Lambda *\id$, where $\id(n)=n$ ($n\in \N$)
and $\Lambda$ is the von Mangoldt function.

Writing the exponential form,
\begin{equation}
\prod_{k=1}^n \left(\Gamma \left(\frac{k}{n}
\right)\right)^{\gcd(k,n)}= (2\pi)^{(P(n)-n)/2} n^{-n/2}
\prod_{d\mid n} d^{\phi(d)/2}.
\end{equation}

Compare this to the following formula given in \cite{SanTot1989}:
\begin{equation}
\prod_{\substack{k=1\\ \gcd(k,n)=1}}^n \Gamma \left(\frac{k}{n}
\right)=  \frac{(2\pi)^{\phi(n)/2}}{\exp(\Lambda(n)/2)}
=\begin{cases} (2\pi)^{\phi(n)/2}/\sqrt{p}, & n=p^a \ \text{(a prime
power)}; \\ (2\pi)^{\phi(n)/2}, & \ \text{otherwise}.
\end{cases}
\end{equation}}
\end{remark}

\subsection{Further special cases}

It is possible to investigate other special cases, too. As examples
we give the next ones with weights regarding, among others, the
floor function $\lfloor \DOT \rfloor$, and the saw-tooth function
$\psi$ defined as $\psi(x)= x-\lfloor x \rfloor-1/2$ for $x\in \R
\setminus \Z$ and $\psi(x)=0$ for $x\in \Z$.

\begin{proposition} For every $n\in \N$,
\begin{equation} \label{gcd_k_}
P_{\id}(n):= \sum_{k=1}^n  k \gcd(k,n)= \frac{n}{2}(P(n)+n).
\end{equation}
\end{proposition}

\begin{proposition} For every $n\in \N$ and $\alpha \in \R$,
\begin{equation} \label{gcd_floor}
P_{\flooro}(n):=\sum_{k=1}^n  \left \lfloor \alpha + \frac{k}{n}
\right \rfloor \gcd(k,n) = \sum_{d\mid n} \phi(d) \left \lfloor
\frac{n\alpha}{d} \right \rfloor.
\end{equation}
\end{proposition}

\begin{proposition} For every $n,r\in \N$,
\begin{equation} \label{gcd_saw_tooth}
P^{(r)}_{\sawo}(n):= \sum_{k=1}^n \psi(kr/n) \gcd(k,n) = 0.
\end{equation}
\end{proposition}

\begin{proposition} For every $n\in \N, n>1$,
\begin{equation} \label{gcd_sin}
P_{\sino}(n):= \sum_{k=1}^{n-1}  (\log \sin (k\pi/n)) \gcd(k,n)=
(\phi*\log)(n) - (\log 2)(P(n)-n).
\end{equation}
\end{proposition}

\begin{proposition} For every $n\in \N$ and $\alpha \in \R$ with $\alpha+k/n \notin \Z$ ($1\le
k\le n$),
\begin{equation}
P_{\coto}(n):= \sum_{k=1}^n  \cot \pi(\alpha + k/n) \gcd(k,n) =
n\sum_{d\mid n} \frac{\phi(d)}{d} \cot(\pi n\alpha/d).
\end{equation}
\end{proposition}

These follow from Proposition \ref{prop_general} using the following
well-known formulae:
\begin{equation}
\sum_{k=1}^n \left \lfloor \alpha+ \frac{k}{n} \right \rfloor =
\left \lfloor n \alpha \right \rfloor, \qquad (n\in \N),
\end{equation}
\begin{equation}
\sum_{k=1}^n \psi(kr/n) = 0 \qquad (n,r\in \N),
\end{equation}
\begin{equation}
\prod_{k=1}^{n-1} \sin (k\pi/n) = \frac{n}{2^{n-1}} \qquad (n\in \N)
\end{equation}
(for $n=1$ the empty product is $1$),
\begin{equation}
\sum_{k=1}^n \cot \pi(\alpha+ k/n) = n \cot \pi n \alpha \qquad
(n\in \N, \alpha \in \R, \alpha+k/n \notin \Z, 1\le k\le n).
\end{equation}

\section{The alternating lcm-sum function}

Some of the previous results have counterparts for the lcm-sum
function (OEIS \seqnum{A051193})
\begin{equation}
L(n): =\sum_{k=1}^n \lcm[k,n] = \frac{n}{2} \left(1+\sum_{d\mid n}
d\phi(d)\right) \qquad (n\in \N).
\end{equation}

We consider here the alternating lcm-sum function defined by
\eqref{lcm_altern_def} and then the analog of \eqref{prod_gcd}.

Let $F(n):=\frac1{n}\sum_{d\mid n} d\phi(d)$. Note that
$F(n)=\sum_{k=1}^n (\gcd(k,n))^{-1}$ representing the arithmetic
mean of the orders of elements in the cyclic group of order $n$, cf.
\cite[p.\ 3]{Tot2010}. Furthermore, let $\beta(n):=(\1*\mu
\id)(n)=\prod_{d\mid n}(1-p)$ and let $h(n):=\prod_{k=1}^n k^k$ be
the sequence of hyperfactorials (OEIS \seqnum{A002109}).

\begin{proposition} Let $n\in \N$. If $n$ is odd, then
\begin{equation} \label{lcm_altern_repr_odd}
L_{\altern}(n)= \frac{n}{2} \left(1+\sum_{d\mid n} d\mu(d)\tau(n/d)
\right)= \frac{n}{2} \left(1+\prod_{p^a\mid \mid n} (a(1-p)+1)
\right),
\end{equation}
where $\tau$ is the divisor function.

If $n$ is even of the form $n=2^am$, where $a\ge 1$ and $m\in \N$ is
odd, then
\begin{equation} \label{lcm_altern_repr_even}
L_{\altern}(n)= 2^{a-1} m \left(\frac{2^{2a}-1}{3}m F(m)-1\right) =
\frac{n}{2} \left(\frac{2^{2a}-1}{2^{2a+1}+1}n F(n)-1\right).
\end{equation}
\end{proposition}

\begin{proof} Let $id_{-1}(n)=n^{-1}$ and $\1(n)=1$ ($n\in \N$). We have
\begin{equation*}
L_{\altern}(n)= n \sum_{k=1}^n (-1)^{k-1}k \frac1{\gcd(k,n)} = n
\sum_{k=1}^n (-1)^{k-1}k \sum_{d\mid \gcd(k,n)} (\id_{-1}* \mu)(d)
\end{equation*}
\begin{equation*}
= n \sum_{d\mid n} \beta(d) \sum_{j=1}^{n/d} (-1)^{dj-1}j.
\end{equation*}

Now using that $\sum_{k=1}^n (-1)^{k-1}k=(-1)^{n-1} \lfloor (n+1)/2
\rfloor$ ($n\in \N$) the given formulae are obtained along the same
lines with the proof of Proposition \ref{prop_gcd_altern}.
\end{proof}

\begin{proposition} For every $n\in \N$,
\begin{equation} \label{prod_lcm}
\left(\prod_{k=1}^n k^{\lcm[k,n]} \right)^{1/n}= \prod_{d\mid n}
h(n/d)^{\beta(d)} \left( \prod_{d\mid n} d^{\beta(d)/d}
\right)^{n/2} \left( \prod_{d\mid n}
d^{\beta(d)/d^2}\right)^{n^2/2}.
\end{equation}
\end{proposition}

\begin{proof} Similar to the proofs of above,
\begin{equation*}
\sum_{k=1}^n (\log k) \lcm[k,n] = n \sum_{k=1}^n (k\log k)
\frac1{\gcd(k,n)}
\end{equation*}
\begin{equation*}
= n \sum_{k=1}^n (k\log k) \sum_{d\mid \gcd(k,n)} (\id_{-1}* \mu)(d)
=  n \sum_{d\mid n} (\id_{-1}* \mu)(d) \sum_{j=1}^{n/d} jd \log (jd)
\end{equation*}
\begin{equation*}
= n \sum_{d\mid n} \beta(d) \log h(n/d) + \frac{n^2}{2} \sum_{d\mid
n} \beta(d) \frac{\log d}{d} + \frac{n^3}{2} \sum_{d\mid n} \beta(d)
\frac{\log d}{d^2},
\end{equation*}
equivalent to \eqref{prod_lcm}.
\end{proof}

\begin{thebibliography}{99}
\bibitem{Com1974} L.~Comtet, {\it Advanced Combinatorics. The Art of Finite and Infinite
Expansions}, D. Reidel Publishing Co., 1974.

\bibitem{NZM} I.~Niven, H.~S.~Zuckerman and H.~L.~Montgomery, {\it
An Introduction to the Theory of Numbers}, 5th ed., John Wiley \&
Sons, 1991.

\bibitem{SanTot1989} J.~S\'andor and L. T\'oth, A remark on the gamma function, {\it Elem.
Math.} {\bf 44} (1989), 73--76.

\bibitem{Sch2008} W.~Schramm, The Fourier transform of functions of the greatest
common divisor, {\it Integers} {\bf 8} (2008), \#A50.

\bibitem{Tot2010} L.~T\'oth, A survey of gcd-sum functions, {\it J. Integer Sequences}
{\bf 13} (2010),
\href{http://www.cs.uwaterloo.ca/journals/JIS/VOL13/Toth/toth10.html}{Article
109.8.1}.

\bibitem{TotHau} L.~T\'oth and P.~Haukkanen, The discrete Fourier transform of $r$-even functions,
submitted, \url{http://arxiv.org/abs/1009.5281v1}

\end{thebibliography}

\bigskip
\hrule
\bigskip

\noindent 2010 {\it Mathematics Subject Classification}: Primary
11A25; Secondary 05A10, 33B15.

\noindent \emph{Keywords:} gcd-sum function, lcm-sum function,
Euler's function, M\"obius function, binomial coefficient, Gamma
function.

\bigskip
\hrule
\bigskip

\noindent (Concerned with sequences \seqnum{A001783},
\seqnum{A002109}, \seqnum{A018804}, \seqnum{A051193},
\seqnum{A056188}, and \seqnum{A159068}.)

\bigskip
\hrule
\bigskip

\vspace*{+.1in}
\noindent
Received May 11 2011;
revised version received  July 18 2011.
Published in {\it Journal of Integer Sequences}, September 5 2011.

\bigskip
\hrule
\bigskip

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


\end{document}

                                                                                

