Trying to define the function $b(n)$ which counts the number of $1$s in the binary representation of $n$ arithmetically I came up with the following definition:
$$b(n)=m :\equiv (\exists k_1\dots k_m)\ k_i \neq k_j \wedge n = 2^{k_1} + \dots + 2^{k_m}$$
Eventhough looking somehow "diophantine", this is - because of the dots $\dots$ - not a sound definition.
Does $b(n)$ have a name by which I can search for it?
What is a sound definition of $b(n)$ in arithmetical terms (using only addition, multiplication, exponentation eventually and if necessary primitive recursion and $\mu$- recursion)?
Notice that other unsound definitions can be made into sound first-order definitions (e.g. addition recursively defined), e.g. $n + k = m :\equiv \operatorname{succ}^k(n) = m$.
Is this something that would fit your requirements?
$b(n) = \begin{cases}0&n=0\\b(\frac n2)&n>0\land n\text{ even}\\b(\frac{n-1}2)+1&n\text{ odd}\end{cases}$