Does anyone know of the mean value of two Ramanujan Sums when summed over the square of integers?


In my research on the [Landau problem](https://en.wikipedia.org/wiki/Landau's_problems) regarding nearly square primes, I have run into the mean value of a product of [Ramanujan Sums](https://en.wikipedia.org/wiki/Ramanujan's_sum):
\begin{equation\*}
\lim\limits\_{N \to \infty}
\frac{1}{N}
\sum\limits\_{n =1}^{N} 
c\_r\left( n^2 \right)
c\_s\left( n^2 \right)
\end{equation\*}


Does anyone know of a listing of properties of Ramanujan Sums similar to the [this one](http://washburnresearch.org/NumberTheory/PropertiesOfRamanujanSums.pdf), but with summations taken over the squares of positive numbers instead summation over the integers? 


The closest I can find is the function, $E\_G$ found in [Sums of products of Ramanujan sums](http://arxiv.org/abs/1104.1906) by Toth. I am interested in the particular case where $g\_1(n) = n^2$ though and not general case case represented by $E\_G$ for and arbitrary set of functions $g\_i(n)$



What is the mean value of a pair of Ramanujan Sums when summed over squares?
Here is a partial answer (**Added:** completed below). Assuming $(r,s)=1$ and denoting $q=rs$, we have
$$ \sum\_{n=1}^N c\_r\left( n^2 \right) c\_s\left( n^2 \right) 
= \sum\_{n=1}^N c\_q\left( n^2 \right) = \sum\_{n=1}^N \sum\_{d\mid(q,n^2)}\mu\left(\frac{q}{d}\right)d = \sum\_{d\mid q}\mu\left(\frac{q}{d}\right)d\sum\_{\substack{{1\leq n\leq N}\\{d\mid n^2}}} 1. $$
Now let $f(d)$ be the number of residue classes modulo $d$ whose square is zero modulo $d$. Then 
$$ \sum\_{n=1}^N c\_r\left( n^2 \right) c\_s\left( n^2 \right) 
= \sum\_{d\mid q}\mu\left(\frac{q}{d}\right)d f(d)\left(\frac{N}{d}+O(1)\right)
= N \sum\_{d\mid q}\mu\left(\frac{q}{d}\right) f(d) + O\_q(1),$$
whence
$$\lim\_{N\to\infty}\frac{1}{N}\sum\_{n=1}^N c\_r\left( n^2 \right) c\_s\left( n^2 \right) 
= \sum\_{d\mid q}\mu\left(\frac{q}{d}\right) f(d).$$
The right hand side is the multiplicative convolution $g:=\mu\ast f$ evaluated at $q$, in particular it is multiplicative in $q$. Hence it suffices to determine $g$ at prime powers $p^k$, which is straightforward:
$$ g(p^k) = f(p^k)-f(p^{k-1}) = p^{\lfloor\frac{k}{2}\rfloor}-p^{\lfloor\frac{k-1}{2}\rfloor}.$$
We infer that the sought mean value equals
$$ g(q) = \begin{cases}\phi(\sqrt{q}),&q=\square\\0,&q\neq\square\end{cases} \tag{$\ast$}$$
Note that under our initial assumptions, $q$ is a square if and only if both $r$ and $s$ are squares.


**Added.** In the general case, i.e. without the coprimality condition on $r$ and $s$, we can proceed as follows. The function $n\mapsto c\_r(n^2)c\_s(n^2)$ is periodic mod $[r,s]$, hence the mean value exists and equals
$$ h(r,s):=\frac{1}{[r,s]}\sum\_{n=1}^{[r,s]}c\_r(n^2)c\_s(n^2). $$
This function satisfies the multiplicativity relation
$$ h(rr',ss') = h(r,s)h(r',s'),\qquad (rs,r's')=1, $$
as follows from the Chinese Remainder Theorem and the invariance property
$$ c\_q(m)=c\_q(km),\qquad (k,q)=1. $$
Therefore,
$$ h(r,s) = \prod\_{p\mid rs}h(p^{v\_p(r)},p^{v\_p(s)}), $$
so that it suffices to evaluate $h(p^k,p^l)$ for any prime $p$ and any exponents $k,l\geq 0$. This is straightforward, given the explicit formulae for $c\_{p^k}(m)$ [here](https://en.wikipedia.org/wiki/Ramanujan's_sum). In particular, for $l>k\geq 0$ we obtain
$$ h(p^k,p^l)=\phi(p^k)h(1,p^l)
=\begin{cases}\phi(p^k)\phi(p^{l/2}),&\text{$l$ even}\\0,&\text{$l$ odd}\end{cases}$$
which generalizes the explicit formula ($\ast$) above.


