Menu

  • Home
  • Archives
  • Tags
  • RSS
February 18, 2015

euler 29 distinct powers

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.


Tags: old-post

« euler 31 coin combinations and over engineering euler 30 sums of powers of digits »

Copyright © 2020 Agam Brahma

Powered by Cryogen