arithmoi-0.7.0.0: Efficient basic number-theoretic functions.

Copyright(c) 2018 Andrew Lelechenko
LicenseMIT
MaintainerAndrew Lelechenko <andrew.lelechenko@gmail.com>
StabilityProvisional
PortabilityNon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

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

Eq Moebius Source # 

Methods

(==) :: Moebius -> Moebius -> Bool #

(/=) :: Moebius -> Moebius -> Bool #

Ord Moebius Source # 
Show Moebius Source # 
Semigroup Moebius Source # 
Monoid Moebius Source # 
Unbox Moebius Source # 
Vector Vector Moebius Source # 
MVector MVector Moebius Source # 
data Vector Moebius Source # 
data MVector s Moebius Source # 

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

Convert to any numeric type.

sieveBlockMoebius :: Word -> Word -> Vector Moebius Source #

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]