Life Goes On

まあまあだけど楽しんでる方です

63問目

http://projecteuler.net/index.php?section=problems&id=63
5桁の数 16807=75 は5乗であり、9桁の数 134217728=89 は9乗になっている。このようにn乗になるn桁の整数は全部でいくつあるか求める。
10乗以上だと桁と指数が一致するものが無いので、9乗まで。

main = print $ euler063

euler063 :: Int
euler063 = length $ concat [takeWhile (test a) [1..] | a <- [1..9]]

test :: Integer -> Integer -> Bool
test a n = (toInteger $ length $ show $ a ^ n) == n