aboutsummaryrefslogtreecommitdiff
path: root/haskell
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-18 20:49:50 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-18 20:49:50 +0100
commit77cf528cf5b14b3beb067f560753b1e5a3960bbd (patch)
tree28260acc930868c822ec94288401fe6ba2a2a8d5 /haskell
parent4c69de67681a1bb6e78c9adf1072a5f3b459e4c9 (diff)
downloadproject_euler-77cf528cf5b14b3beb067f560753b1e5a3960bbd.tar.gz
project_euler-77cf528cf5b14b3beb067f560753b1e5a3960bbd.tar.bz2
project_euler-77cf528cf5b14b3beb067f560753b1e5a3960bbd.zip
problem 23 c
Diffstat (limited to 'haskell')
-rw-r--r--haskell/wip/023-non_abundant_sum.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/haskell/wip/023-non_abundant_sum.hs b/haskell/wip/023-non_abundant_sum.hs
index d519eb6..9174aef 100644
--- a/haskell/wip/023-non_abundant_sum.hs
+++ b/haskell/wip/023-non_abundant_sum.hs
@@ -46,12 +46,12 @@ notAbundantSum x
abundants = [n | n <- [1..28123], divSum n > n]
divSum :: Int -> Int
-divSum n = factorise 2
- where factorise d
+divSum n = factorize 2
+ where factorize d
| d > nSqrt = 1
- | rest == 0 && d /= quotient = d + quotient + factorise (d + 1)
- | rest == 0 && d == quotient = quotient + factorise (d + 1)
- | otherwise = factorise (d + 1)
+ | rest == 0 && d /= quotient = d + quotient + factorize (d + 1)
+ | rest == 0 && d == quotient = quotient + factorize (d + 1)
+ | otherwise = factorize (d + 1)
where quotient = n `div` d
rest = n `mod` d
nSqrt = floor $ sqrt $ fromIntegral n