Statutory Warning: Spoilers ahead!
Finally, we have a one-liner:
euler29 = length $ L.nub $ [a ^ b | a <- [2 .. 100], b <- [2 .. 100]]
(where L
is Data.List
)
P.S. I did make a dumb error by initiall writing this as two functions, with the second one taking Int
instead of Integer
, which (I'm disappointed to say) resulted in everything silently overflowing to negative numbers.