What you're finding is called the **digital root** or **iterated digit sum**.
For positive $x$, the digital root is $9$ if $x$ is a multiple of $9$; otherwise it is the remainder of the division $x\div 9$.
What you're finding is called the **digital root** or **iterated digit sum**.
For positive $x$, the digital root is $9$ if $x$ is a multiple of $9$; otherwise it is the remainder of the division $x\div 9$.