Hi
I have the following recursive function for project euler question no. 74:
chain n | n `elem` xs = length xs
| otherwise = (chain (sumFac n)) : xs
fac n = foldl (*) 1 $ enumFromTo 1 n
sumFac n = sum $ map fac $ decToList n
Except I don't know the correct syntax to construct a list on chain n
so that it builds up a list of xs
and then returns the length of xs
once a number appears again in the list of xs
and begins to loop.
How would I correct my chain function to make it work?