arithmoi-0.11.0.0: Efficient basic number-theoretic functions.

Copyright (c) 2018 Andrew Lelechenko MIT Andrew Lelechenko None Haskell2010

Math.NumberTheory.ArithmeticFunctions.Moebius

Description

Values of Möbius function.

Synopsis

# Documentation

data Moebius Source #

Represents three possible values of Möbius function.

Constructors

 MoebiusN 1 MoebiusZ 0 MoebiusP 1
Instances
 Source # Instance details Methods(==) :: Moebius -> Moebius -> Bool #(/=) :: Moebius -> Moebius -> Bool # Source # Instance details Methods(<) :: Moebius -> Moebius -> Bool #(<=) :: Moebius -> Moebius -> Bool #(>) :: Moebius -> Moebius -> Bool #(>=) :: Moebius -> Moebius -> Bool # Source # Instance details MethodsshowList :: [Moebius] -> ShowS # Source # Instance details Methodsstimes :: Integral b => b -> Moebius -> Moebius # Source # Instance details Methodsmconcat :: [Moebius] -> Moebius # Source # Instance details Source # Instance details MethodsbasicUnsafeIndexM :: Monad m => Vector Moebius -> Int -> m Moebius #basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) Moebius -> Vector Moebius -> m () #elemseq :: Vector Moebius -> Moebius -> b -> b # Source # Instance details MethodsbasicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) Moebius) #basicInitialize :: PrimMonad m => MVector (PrimState m) Moebius -> m () #basicUnsafeReplicate :: PrimMonad m => Int -> Moebius -> m (MVector (PrimState m) Moebius) #basicUnsafeRead :: PrimMonad m => MVector (PrimState m) Moebius -> Int -> m Moebius #basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) Moebius -> Int -> Moebius -> m () #basicClear :: PrimMonad m => MVector (PrimState m) Moebius -> m () #basicSet :: PrimMonad m => MVector (PrimState m) Moebius -> Moebius -> m () #basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) Moebius -> MVector (PrimState m) Moebius -> m () #basicUnsafeMove :: PrimMonad m => MVector (PrimState m) Moebius -> MVector (PrimState m) Moebius -> m () #basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) Moebius -> Int -> m (MVector (PrimState m) Moebius) # newtype Vector Moebius Source # Instance details newtype Vector Moebius = V_Moebius (Vector Int8) newtype MVector s Moebius Source # Instance details newtype MVector s Moebius = MV_Moebius (MVector s Int8)

runMoebius :: Num a => Moebius -> a Source #

Convert to any numeric type.

Evaluate the Möbius function over a block. Value of f at 0, if zero falls into block, is undefined.

Based on the sieving algorithm from p. 3 of Computations of the Mertens function and improved bounds on the Mertens conjecture by G. Hurst. It is approximately 5x faster than sieveBlockUnboxed.

>>> sieveBlockMoebius 1 10
[MoebiusP,MoebiusN,MoebiusN,MoebiusZ,MoebiusN,MoebiusP,MoebiusN,MoebiusZ,MoebiusZ,MoebiusP]