2
$\begingroup$

What exactly does this notation mean when using it to define a function?

$f(x) = f(\text{ sum of the digits of }x) \{ \mathrm{if}( x \ge 10) \} = x \{ \mathrm{if}( x \lt 10) \} $

Thanks

  • 0
    @Arturo Magidin:Aha,I get it! Just the whole thing in a single line makes it a $b$it messy.Thanks.2011-02-14

2 Answers 2

5

It means that which formula applies depends on which condition holds. Explicilty, it is equivalent to $f(x) = \left\{\begin{array}{ll} f(\mbox{sum of the digits of $x$}) &\mbox{if $x\geq 10$}\\ x &\mbox{if $x\lt 10$.} \end{array}\right.$ which recursively defines the function for every positive integer.

For example, if $x=481754$, then $x\geq 10$, so \begin{align*} f(x) &= f(481754) = f(4+8+1+7+5+4)\\ &= f(29) = f(2+9)\\ &= f(11) = f(1+1)\\ &= f(2) = 2. \end{align*}

This is the function that reduces an integer to its residue class modulo $9$ ("casting out nines"), using $9$ as the representative for the multiples of $9$ (instead of $0$).

  • 1
    Adding to Arturo's answer one can compute $f(x)$ as : f(x) = \left\{\begin{array}{ll} 9 &\mbox{if $9|x$}\\ Mod[x,9] &\mbox{ otherwise } \end{array}\right.2011-02-14
5

If $x\lt 10$, $f(x)=x$

If $x \ge 10$, to get $f(x)$ add up the digits of x, presumably in base 10, then repeat until you get below 10.

So for example, $f(6)=6, f(18)=9, f(987)=f(24)=6, f(1234)=f(10)=1$

  • 0
    @Arturo: no problem2011-02-14