# A four-part trilogy

Define a function $$f : \mathbb{N} \rightarrow \mathbb{Z}^{+} \cup \{0\}$$ such that

$$f(1) = 0, f(p) = 1$$ for $$p$$ prime, and $$f(mn) = mf(n) + nf(m).$$

Let $$A$$ be the sum of all $$n \lt 1,000,000$$ such that $$f(n) = n.$$

Let $$B$$ be the maximum value of $$\dfrac{f(n)}{n}$$ for $$n \le 1000.$$

Let $$C$$ be the maximum value of $$f(n)$$ for $$n \le 1000.$$

Finally, let $$D = f(1000) + f(42).$$

Find $$A + 2B + C + D.$$

×