toy-lib
Safe HaskellNone
LanguageHaskell2010

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

Split and list / meet in the middle

Other problems

Synopsis

Documentation

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].

countDivisors :: Vector Int -> Vector Int #

For instance, [6], i.e., [0, 0, 0, 0, 0, 0, 1] becomes [0, 1, 1, 1, 0, 0, 1].

Typical problems