| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Math.Divisors
Description
The number of divisor is smaller than \(log N\). See also: https://scrapbox.io/magurofly/%E7%B4%84%E6%95%B0%E3%81%AE%E5%80%8B%E6%95%B0%E3%81%AE%E3%82%AA%E3%83%BC%E3%83%80%E3%83%BC
Tips
- The last number could be decided with division, not enumeration.
Typical problems
Prime factors
- Typical 030 - K Factors (★5) Numbers with i >= k prime factors can be enumerated very fastly.
Split and list / meet in the middle
Other problems
Synopsis
- divisorsOf :: Int -> [Int]
- countDivisorsInPlace :: (PrimMonad m, MVector v a, Num a) => Vector Int -> v (PrimState m) a -> m ()
- countDivisors :: Vector Int -> Vector Int
Documentation
divisorsOf :: Int -> [Int] #
countDivisorsInPlace :: (PrimMonad m, MVector v a, Num a) => Vector Int -> v (PrimState m) a -> m () #
For instance, [6], i.e., [0, 0, 0, 0, 0, 0, 1] becomes [0, 1, 1, 1, 0, 0, 1].