Permalink
Browse files

** dumbassery

  • Loading branch information...
1 parent fc2aeb3 commit 55f49900606ec1cbede3772eba3353d05a2c2e18 Andrew Korzhuev committed Apr 16, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 euler/16.hs
  2. +1 −1 euler/5.hs
  3. +2 −2 euler/6.hs
View
@@ -4,4 +4,4 @@ import Data.Char
digitSum = sum . map digitToInt . show
-main = print $ digitSum . truncate $ 2**1000
+main = print $ digitSum (2^1000)
View
@@ -20,7 +20,7 @@ primesToG m = 2 : sieve [3,5..m] where
| p*p > m = p : xs
| otherwise = p : sieve (xs `minus` [p*p, p*p+2*p..])
-maxPower x y = ceiling $ x ** (fromIntegral . floor $ logBase x y)
+maxPower x y = x ^ (floor $ logBase x y)
answer x = product . map (flip maxPower x) . primesToG $ x
View
@@ -1,7 +1,7 @@
-- Find the difference between the sum of the squares of
-- the first one hundred natural numbers and the square of the sum.
-sumSqr = sum . map (** 2)
-sqrSum = (** 2) . sum
+sumSqr = sum . map (^ 2)
+sqrSum = (^ 2) . sum
main = putStrLn . show $ (sqrSum [1..100]) - (sumSqr [1..100])

0 comments on commit 55f4990

Please sign in to comment.