# How to delineate a summation of digits in a number?

Let's say we have an integer x. How should I delineate a summation of its' digits until I get a single digit.

For example:

x = 12345
1 + 2 + 3 + 4 + 5 = 15
1 + 5 = 6


I believe it is possible, just can't find a mathematical way to do so. Would be glad if anyone shared their ideas or point me to the right direction.

-

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$.

-