Problem 29

Here is my solution for the 29th Euler problem:

    import List

    f = length $ nub [a^b | a <- [2..100],
                            b <-[2..100]]

    main = print f

Thanks to Haskell, it was relatively easy to solve. GHC’s execution time was:

real 0m0.650s user 0m0.646s sys 0m0.003s

Published: May 14 2010

blog comments powered by Disqus