6 lines
157 B
Haskell
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)
|