The 'prime logarithm' Lately I've been thinking about the functional equation $$f(ab) = f(a) + f(b)$$ but not in the usual sense where continuity or differentiability are assumed. It's clear that $f(1) = 0$, by letting $a = b = 1$. It is also clear, that given any natural number $n = p_1^{a_1}p_2^{a_2}\cdots p_m^{a_m}$ that $f(n) = a_1f(p_1) + a_2f(p_2) + ... + a_mf(p_m)$.
Consider the function $\ell:\mathbb N\setminus\{0\}\to\mathbb N$ such that it is a solution to the functional equation, and $\ell(p) = p$ when $p$ is prime. 
Some example values:
$$\ell(1) = 0\\\ell(2) = 2\\\ell(15) = \ell(5) + \ell(3) = 8\\\ell(264) = 3\ell(2) + \ell(3) + \ell(11) = 20$$
Here is a plot of the function for $1 \leq n \leq 1000$:


So my question is, does this function have a name? Does it have any useful purpose, or interesting properties? It seems we can extend the domain of this function to the positive rational numbers, making the range $\mathbb Z$ rather than $\mathbb N$.
Some values if we extend to rational numbers:
$$\ell\left(\frac12\right) = -2\\\ell\left(\frac{7}{9}\right) = \ell(7) - 2\ell(3) = 1 \\\ell\left(\frac{42}{110}\right) = \ell(2) + \ell(3) + \ell(7) - \ell(11)-\ell(5) - \ell(2) = -6$$
Notice how the common factors cancelled out in the last example without having to simplify the fraction, showing that $\ell$ is well defined for all $n \in \mathbb Q^+\setminus\{0\}$.
* I made the graph quickly on excel, please feel free to replace it with a better one.
 A: The function $\ell$ on $\Bbb N$ is the sum of prime factors (function), or a little less literally, the integer logarithm.
P.A. MacMahon calls $ell(n)$ the potency of $n$ (see P.A. MacMahon, Properties of Prime Numbers Deduced from the Calculus of Symmetric Functions, Proc. London Math. Soc. (1925) s2-23 (1): 290-316.)
The values $\ell(1), \ell(2), \ldots$ are the content of OEIS A001414, and this sequence has its own OEIS Wiki page.
Note that the extended map on $\Bbb Q_+$ is a group homomorphism $(\Bbb Q_+, \,\cdot\,) \to (\Bbb Z, +)$.
A: Long comment:
The commutative monoid $(\mathbb{N}\setminus\{0\},\times,1)$ is freely generated (as a commutative monoid) by the prime numbers. In other words, for any commutative monoid $X$ and any function $f:\mathbb{P} \rightarrow X$, there's a unique homomorphism $\hat{f}:(\mathbb{N}\setminus\{0\},\times,1) \rightarrow X$ such that the restriction of $\hat{f}$ to $\mathbb{P}$ is $f.$


*

*Your function is $\hat{f}$ for the special case where $X = (\mathbb{N},+,0)$ and $f:\mathbb{P} \rightarrow X$ is defined by $f(p) = p$.

*If instead of adding prime factors, you just want $\hat{f}$ to count them, take $f(p) = 1$ instead.

*If you want $\hat{f}$ to compute the radical of a number, take $X = (\mathbb{N},\mathrm{lcm},1)$ and $f(p) = p$.

*If you want $\hat{f}$ to tell you the largest prime in the factorization, take $X=(\mathbb{P},\mathrm{max},2)$ or $X = (\mathbb{N},\mathrm{max},0)$, either one, and define $f(p) = p$.
I find these kinds of functions super-cool, by the way.
Also, note that $(\mathbb{Q}_{>0},\times,1)$ is the commutative group freely generated by $\mathbb{P}$. So you can do similar stuff in that context.

Addendum.
Also, note that for all $a,b \geq 2$, we have $a+b \leq ab$. Hence if $\hat{f}$ is the function you're interested in, then $\hat{f}(n) \leq n$. So letting $n \geq 2$ denote be fixed, we see that the sequence $$(n,\hat{f}(n),\hat{f}(\hat{f}((n)),\ldots)$$ is eventually constant. Two obvious questions are:


*

*How many steps before its constant?

*What is the final value of this sequence? (I think it will always be prime.)


For example, applying $\hat{f}$ repeatedly to $15$, we get:
$$15 \mapsto 8 \mapsto 6 \mapsto 5 \mapsto 5 \mapsto 5 \mapsto \cdots$$
so it takes $3$ steps and we stabilize at $5$.
Kind of cool, huh? This gives us a potentially interesting way of assigning to each element of $\mathbb{N}_{\geq 2}$ a prime number (e.g. to $15$ we assign $5$.) We might write $\hat{f}^{\infty}(15) = 5$ or something like that. Perhaps this number tells us something important about the structure of the number we started with.
