Largest proper divisor of n: Difference between revisions

m
Line 288:
maxProperDivisors :: Int -> Int
maxProperDivisors n
| 1null < length abxs = quot n (last ab)1
| otherwise = 1quot n (head xs)
where
root = (floor . sqrt) (fromIntegral n :: Double)
abxs = take 21 [x | x <- [12 .. root], 0 == rem n x]
 
main :: IO ()
9,655

edits