diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-04-10 05:25:03 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-04-10 05:25:03 +1000 |
commit | 281425310c5db21f87981eeb9601a71d1974d98d (patch) | |
tree | bef4643d906c93622c311fef2cf758fe94f1f651 /misc.hs | |
parent | e8695600977769008f285f9958eb043cca1b9b29 (diff) |
Rearranging files
Diffstat (limited to 'misc.hs')
-rw-r--r-- | misc.hs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/misc.hs b/misc.hs deleted file mode 100644 index f7623e4..0000000 --- a/misc.hs +++ /dev/null @@ -1,35 +0,0 @@ - - - - -modulo :: Int -> Int -> Int -modulo x y = - x - (x `div` y) * y - - - -primeFactors :: Int -> [Int] -primeFactors x = - let p = (\x e c -> if (x == 1) - then (reverse c) - else if (x `modulo` (head e) == 0) - then p (x `div` (head e)) e ((head e) : c) - else p x (tail e) c) - in p x euler [] - - - -euler :: [Int] -euler = - let f = (\list -> (head list) : (f (filter (\x -> x `modulo` (head list) /= 0) list))) - in f [2..] - - - -isPowerOf :: Int -> Int -> Bool -isPowerOf x y = - case (compare x y) of - LT -> False - EQ -> True - GT -> if (x `modulo` y == 0) then isPowerOf (x `div` y) y else False - |