[clean-list] stupid question

TK 0000tk at gmail.com
Tue Dec 11 18:35:03 MET 2007


Greetings, Arie!


On Dec 11, 2007 6:19 PM, Arie Groeneveld <bradypus at xs4all.nl> wrote:

>  TK schreef:
>
> He wants to repeatedly sum digits until ( number < 10 ) in order to check
> divisibility by 9 like
>
>
> digitalRoot    x = limit ( iterate digitSum x )
>
> digitSum 0    = 0
> digitSum x    = ones x + digitSum ( x / 10 )
>
>  If the problem is checking divisibility by 9,
> then I suggest to use what the language offers you:
>
The problem might be implementing the aforementioned algorithm.


div9 :: Int -> Bool
>
> div9 x
>
>             | x mod 9 == 0 = True
>
>             | otherwise = False
>
or

div9 x = x rem 9 == 0

( StdEnv has no "instance mod Int" )


Wish you all the best.

TK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.science.ru.nl/pipermail/clean-list/attachments/20071211/593c334b/attachment.html


More information about the clean-list mailing list