Add solution for problem 63.
This commit is contained in:
parent
20472682ac
commit
f3f4b456ab
|
|
@ -0,0 +1,6 @@
|
|||
-- How many n-digit positive integers exist which are also an nth power?
|
||||
import Data.List (nub)
|
||||
|
||||
-- If x >= 10 then x^n >= 10^n and thus has more than n digits.
|
||||
-- If n >= 22 then 9^n < 10^(n-1) and thus has fewer than n digits.
|
||||
main = print $ length $ nub [ x^n | n <- [1..21], x <- [1..9], x^n >= 10^(n-1) ]
|
||||
Loading…
Reference in New Issue