Solution (source code)

= Solution

An <arithmetic function> $f$ is <multiplicative arithmetic function>[multiplicative] if $f(mn)=f(m)f(n)$ whenever $m$ and $n$ are <coprime integers>. If $g(n)=\sum_{d\mid n}f(d)$ and $(m,n)=1$, every positive <integer divisor> of $mn$ is uniquely $d_1d_2$ with $d_1\mid m$ and $d_2\mid n$. Hence
$$
g(mn)=\sum_{d_1\mid m}\sum_{d_2\mid n}f(d_1d_2)
=\left(\sum_{d_1\mid m}f(d_1)\right)
 \left(\sum_{d_2\mid n}f(d_2)\right)
=g(m)g(n),
$$
so $g$ is <multiplicative arithmetic function>[multiplicative].

The <Möbius function> is defined by $\mu(1)=1$, $\mu(n)=0$ if the <square number>[square] of a <prime number> divides $n$, and $\mu(n)=(-1)^r$ if $n$ is a product of $r$ distinct <prime numbers>. Coprime integers have disjoint sets of <prime factors>, so this definition immediately gives $\mu(mn)=\mu(m)\mu(n)$ when $(m,n)=1$.

For $n=p_1^{a_1}\cdots p_r^{a_r}>1$, only the <square-free integer>[square-free] divisors contribute, and therefore
$$
\sum_{d\mid n}\mu(d)=\prod_{j=1}^r(1-1)=0.
$$
For $n=1$ the sum is $1$. Thus $\mathbf 1*\mu=\varepsilon$ in the language of <Dirichlet convolution>. Convolving $g=\mathbf 1*f$ with $\mu$ gives the <Möbius inversion formula>
$$
f(n)=(\mu*g)(n)=\sum_{e\mid n}\mu(e)g(n/e).
$$

If $f(n)=n$, its <divisor sum> is the <sum-of-divisors function>. Conversely, if $g(n)=n$, <Möbius inversion> gives
$$
f(n)=\sum_{e\mid n}\mu(e)\frac ne=\varphi(n),
$$
using the standard divisor identity for the <Euler totient function>. Therefore the two requested answers are
$$
\boxed{g(n)=\sigma_1(n),\qquad f(n)=\varphi(n).}
$$