Showing that an arithmetic function is multiplicative Let $f$ be an arithmetic function that counts the number of consecutive integers between $1$ and $n$ (inclusive) such that both integers are coprime to $n$. More formally,
$$ f(n) = \sum_{\substack{1 \leq t \leq n \\ (t,n)=1 \\ (t+1,n)=1}}1. $$
An immediate observation is that $f(n)=0$ when $n$ is even. After playing around with this function, I suspect that it is multiplicative. That is, if $(a,b)=1$, then $f(ab)=f(a)f(b)$. However, I am unable to prove this.
Is this function really multiplicative or are there counterexamples?
Also, what happens when we modify $f$ so that it counts the number of consecutive triplets that are all coprime to $n$?

Let $m$ and $n$ be coprime positive integers. Chinese reminder theorem gives us a ring isomorphism
$$
g: \mathbb{Z}/mn\mathbb{Z} \to \mathbb{Z}/m\mathbb{Z} \times \mathbb{Z}/n\mathbb{Z} \\
x\pmod{mn} \mapsto (x\pmod m, x\pmod n).
$$
For integer $k$, define $A_k \subset \mathbb{Z}/k\mathbb{Z}$ as
$$
A_k = \{t \in \mathbb{Z}/k\mathbb{Z} \, | \, \gcd(t, k) = 1 \land \gcd(t + 1, k) = 1\}.
$$
Note that $x \in A_k$ if and only if both $x$ and $x + 1$ are units in the ring $\mathbb{Z}/k\mathbb{Z}$ i.e. $x \in A_k$ if and only if there exist $y \in \mathbb{Z}/k\mathbb{Z}$ and $z \in \mathbb{Z}/k\mathbb{Z}$ such that
$$
xy = 1 \pmod k \\
(x + 1)z = 1 \pmod k.
$$
Since $g$ preserves inverses, we see that  $t \in A_{mn}$ if and only if $g(t) = (t_1, t_2)$ with $t_1 \in A_m$ and $t_2 \in A_n$. Thus, $g$ restricted to $A_{mn}$ is a bijection between $A_{mn}$ and $A_m \times A_n$. Therefore, $|A_{mn}| = |A_m| |A_n|$.
Multiplicativity of $f$ follows since $f(k) = |A_k|$.

Using the result above and the observation that $f(p^k) = p^{k-1}(p - 2)$ for prime $p$, one can derive a formula for $f(n)$ where $n = p_1^{k_1}p_2^{k_2}\dots p_r^{k_r}$
$$
f(n) = \prod_{i=1}^r p_i^{k_i-1} (p_i - 2) = n \prod_{i=1}^r \left(1 - \frac{2}{p_i}\right)
$$
which is reminiscent of a similar formula for the Euler totient function.
