Whitespace fix in 39.
Whitespace fix in 40.
Got rid of -1 in 40.
Simplified 40 with concatMap.
Refactored 40 in terms of digits function.