Safe Haskell | None |
---|---|
Language | GHC2021 |
Math.Prime.Divisor
Synopsis
- data DivisorCache a = DivisorCache {}
- buildDivisorCache :: (Integral a, Unbox a) => Int -> DivisorCache a
- divisors :: Unbox a => DivisorCache a -> Int -> Vector a
- naiveDivisors :: Int -> [Int]
- numDivisors :: Unbox a => DivisorCache a -> Int -> Int
Documentation
data DivisorCache a Source #
Constructors
DivisorCache | |
buildDivisorCache :: (Integral a, Unbox a) => Int -> DivisorCache a Source #
divisors :: Unbox a => DivisorCache a -> Int -> Vector a Source #
>>>
dc = buildDivisorCache @Int 100
>>>
divisors dc 60
[1,2,3,4,5,6,10,12,15,20,30,60]>>>
divisors dc 0
[]>>>
divisors dc 1
[1]>>>
divisors dc 2
[1,2]>>>
divisors dc 100
[1,2,4,5,10,20,25,50,100]
naiveDivisors :: Int -> [Int] Source #
>>>
naiveDivisors 60
[1,60,2,30,3,20,4,15,5,12,6,10]>>>
naiveDivisors 0
[]>>>
naiveDivisors 1
[1]>>>
naiveDivisors 100
[1,100,2,50,4,25,5,20,10]>>>
length $ naiveDivisors 720720
240
numDivisors :: Unbox a => DivisorCache a -> Int -> Int Source #