### Title

Adding digits 1234 = 1+2+3+4 = 10= 1+ 0= 1

### Post

Anyone know how to create a calculation using FMP 10 Advanced? Thanks for all of your suggestions : ) I am trying to do an automated color and numbers calendar and got stuck thinking there must be a quick way of making FMP Advanced do a lot of the work rather than the end user.

Here's a CF that seems to work, even for large input numbers:

Function Name: Digital Value

Function Parameters: Number

DigitalValue ( number ) =

Let ( $TheNumber = GetAsNumber ( Number );

Case ( $TheNumber < 10; $TheNumber; DigitalValue ( Left ( $TheNumber; 1 ) + DigitalValue ( Right ( $TheNumber; Length ( $TheNumber ) - 1 ) ) )

)

)

Howdy,

A digital value is pretty much what the title of the post shows. Add all the digits together to come up with a sum, and if the sum is multidigit, add those digits together, and on and on until you are left with a single digit...the digital value.

They're sometimes used as verification criteria for fast-checking previous work, among other things.

(I always thought that doing the work right in the first place was better, though...but that's me)

I believe the sum of digits is called

digit sum, and the output of repeating the process on the result until a single-digit number is reached is calledrepeated digital sumordigital root.However, I must correct my earlier statement: while digit sum requires a recursive calculation, digital root can be calculated simply by Raman's formula =

1 + Mod ( number - 1 ; 9 )

Comment wrote:

"What on Earth is a "digital value"?"

Sorry . . . I meant digital root!