Following is an experimental math claim.


We denote $(a,b)=\gcd(a,b)$.


Let $$G(a)=\sum\_{i=1}^{a-1}(-1)^i(a,i).$$


Note:


$$ G(a) =
\begin{cases}
0, & \text{if $a\equiv 1\pmod4$} \\
\text{odd}, & \text{if $a\equiv 2\pmod4$} \\
0, & \text{if $a\equiv 3\pmod4$} \\
\text{even}, & \text{if $a\equiv 0\pmod4$.} 
\end{cases}$$



> 
> Can it be shown that for every $a\in\mathbb{Z}\_{\ge2}$, $G(a)\ge-1$?
> 
> 
> 


Table


$$\begin{array}{|c |c |} \hline a & G(a) \\ \hline
2 & -1 \\ \hline
3 & 0 \\ \hline
4 &0 \\ \hline
5 &0 \\ \hline
6 &-1 \\ \hline
7 &0 \\ \hline
8 &4 \\ \hline
9 &0 \\ \hline
\vdots &\vdots \\ \hline
 \end{array}$$


source code PARI/GP



```
for(a=1,10000,if(sum(i=1,a-1, (-1)^i*gcd(a, i))<-1,print([a])))

```


Is it always true that $\sum_{i=1}^{a-1}(-1)^i(a,i)\ge-1$?
Yes, it is true. Further we suppose that $a=2b$ is even, as for odd $a$ the sum $G(a)$ equals 0 due to pairing $\{i,a-i\}$.


We start with $$(a,i)=\sum\_{d|(a,i)}\varphi(d)=\sum\_{d|a} \varphi(d)\cdot \mathbf{1}\_{d|i}.$$ Therefore
$$
G(a)=\sum\_{i=1}^{a-1}(-1)^i(a,i)=\sum\_{d|a}\varphi(d)\sum\_{i=1}^{a-1}(-1)^i \mathbf{1}\_{d|i}.
$$
The inner sum $\sum\_{i=1}^{a-1}(-1)^i \mathbf{1}\_{d|i}$ equals $a/d-1$ if $d$ is even and equals $-1$ if $d$ is odd (since it is a sum of $a/d-1=2b/d-1$ alternating $\pm 1$'s). Thus $$G(a)=\sum\_{d|a,d\,\text{is even}} \varphi(d)(a/d-1)-\sum\_{d|a,d\,\text{is odd}}\varphi(d).$$
Denote $b=2^sc$ for non-negative integer $s$ and odd $c$. Then odd divisors of $a$ are exactly divisors of $c$, and we have
$$
\sum\_{d|a,d\,\text{is odd}}\varphi(d)=\sum\_{d|c}\varphi(d)=c.
$$
If 4 divides $a$, then $a/(2d)-1\geqslant 1$ for each divisor $d$ of $c$, and we get
$$
\sum\_{d|a,d\,\text{is even}} \varphi(d)(a/d-1)\geqslant 
\sum\_{d|c} \varphi(2d)(a/(2d)-1)\geqslant \sum\_{d|c} \varphi(2d)=\sum\_{d|c} \varphi(d)=c,
$$
thus $G(a)\geqslant 0$.
Finally, it remains to consider the case when $b=c$ is odd. Then we have
$$
\sum\_{d|a,d\,\text{is even}} \varphi(d)(a/d-1)=\sum\_{d|c} \varphi(2d)(a/(2d)-1)=
\sum\_{d|c}\varphi(d)(c/d-1)=-c+c\sum\_{d|c} \varphi(d)/d,
$$
and $G(a)\geqslant -1$ reads as
$$c\sum\_{d|c} \varphi(d)/d\geqslant 2c-1.$$
This may be proved by
$$
\sum\_{d|c} \varphi(d)/d=1+\sum\_{d|c,d>1} \varphi(d)/d\geqslant 1+
\sum\_{d|c,d>1} \varphi(d)/c=1+(c-1)/c=(2c-1)/c.
$$


