In number theory, the gcd-sum function, also called Pillai's arithmetical function, is defined for every n {\displaystyle n} by
P ( n ) = ∑ k = 1 n gcd ( k , n ) {\displaystyle P(n)=\sum _{k=1}^{n}\gcd(k,n)}
or equivalently
P ( n ) = ∑ d ∣ n d φ ( n / d ) {\displaystyle P(n)=\sum _{d\mid n}d\varphi (n/d)}
where d {\displaystyle d} is a divisor of n {\displaystyle n} and φ {\displaystyle \varphi } is Euler's totient function. it also can be written as
P ( n ) = ∑ d ∣ n d τ ( d ) μ ( n / d ) {\displaystyle P(n)=\sum _{d\mid n}d\tau (d)\mu (n/d)}
where, τ {\displaystyle \tau } is the divisor function, and μ {\displaystyle \mu } is the Möbius function. This multiplicative arithmetical function was introduced by the Indian mathematician Subbayya Sivasankaranarayana Pillai in 1933.
References
(sequence A018804 in the OEIS)
