mykatas/haskell/1_persistent_bugger.hs

6 lines
157 B
Haskell

import Data.Char(digitToInt)
persistence :: Int -> Int
persistence n
| n < 10 = 0
| otherwise = 1 + persistence (product $ map digitToInt $ show n)