Hoogle Search
Within LTS Haskell 24.41 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
apecs Apecs.Experimental.Reactive Prints a message to stdout every time a component is updated.
newtype
Pushdown (s :: Type -> Type) capecs Apecs.Experimental.Stores Overrides a store to have history/pushdown semantics. Setting this store adds a new value on top of the stack. Destroying pops the stack. You can view the entire stack using the Stack wrapper.
Pushdown :: s (Stack c) -> Pushdown (s :: Type -> Type) capecs Apecs.Experimental.Stores No documentation available.
data
PrimitiveCharacter (n :: Nat)arithmoi Math.NumberTheory.DirichletCharacters A Dirichlet character is primitive if cannot be induced from any character with strictly smaller modulus.
-
arithmoi Math.NumberTheory.Moduli.Multiplicative PrimitiveRoot m is a type which is only inhabited by primitive roots of m.
module Math.NumberTheory.
Prefactored Type for numbers, accompanied by their factorisation.
-
arithmoi Math.NumberTheory.Prefactored A container for a number and its pairwise coprime (but not necessarily prime) factorisation. It is designed to preserve information about factors under multiplication. One can use this representation to speed up prime factorisation and computation of arithmetic functions. For instance, let p and q be big primes:
>>> let p = 1000000000000000000000000000057 :: Integer >>> let q = 2000000000000000000000000000071 :: Integer
It would be difficult to compute the totient function of their product as is, because once we multiplied them the information of factors is lost and totient (p * q) would take ages. Things become different if we simply change types of p and q to prefactored ones:>>> let p = 1000000000000000000000000000057 :: Prefactored Integer >>> let q = 2000000000000000000000000000071 :: Prefactored Integer
Now the totient function can be computed instantly:>>> import Math.NumberTheory.ArithmeticFunctions >>> prefValue $ totient (p^2 * q^3) 8000000000000000000000000001752000000000000000000000000151322000000000000000000000006445392000000000000000000000135513014000000000000000000001126361040 >>> prefValue $ totient $ totient (p^2 * q^3) 2133305798262843681544648472180210822742702690942899511234131900112583590230336435053688694839034890779375223070157301188739881477320529552945446912000
Let us look under the hood:>>> import Math.NumberTheory.ArithmeticFunctions >>> prefFactors $ totient (p^2 * q^3) Coprimes {unCoprimes = [(1000000000000000000000000000057,1),(41666666666666666666666666669,1),(2000000000000000000000000000071,2),(111111111111111111111111111115,1),(2,4),(3,3)]} >>> prefFactors $ totient $ totient (p^2 * q^3) Coprimes {unCoprimes = [(39521,1),(227098769,1),(22222222222222222222222222223,1),(2000000000000000000000000000071,1),(361696272343,1),(85331809838489,1),(6046667,1),(199937,1),(5,3),(41666666666666666666666666669,1),(2,22),(3,8)]}Pairwise coprimality of factors is crucial, because it allows us to process them independently, possibly even in parallel or concurrent fashion. Following invariant is guaranteed to hold:abs (prefValue x) = abs (product (map (uncurry (^)) (prefFactors x)))
module Math.NumberTheory.
Primes No documentation available.
-
arithmoi Math.NumberTheory.Primes Wrapper for prime elements of a. It is supposed to be constructed by nextPrime / precPrime. and eliminated by unPrime. One can leverage Enum instance to generate lists of primes. Here are some examples.
- Generate primes from the given interval:
>>> :set -XFlexibleContexts >>> [nextPrime 101 .. precPrime 130] [Prime 101,Prime 103,Prime 107,Prime 109,Prime 113,Prime 127]
- Generate an infinite list of primes:
[nextPrime 101 ..] [Prime 101,Prime 103,Prime 107,Prime 109,Prime 113,Prime 127...
- Generate primes from the given interval of form p = 6k+5:
>>> [nextPrime 101, nextPrime 107 .. precPrime 150] [Prime 101,Prime 107,Prime 113,Prime 131,Prime 137,Prime 149]
- Get next prime:
>>> succ (nextPrime 101) Prime 103
- Get previous prime:
>>> pred (nextPrime 101) Prime 97
- Count primes less than a given number (cf. approxPrimeCount):
>>> fromEnum (precPrime 100) 25
- Get 25-th prime number (cf. nthPrimeApprox):
>>> toEnum 25 :: Prime Int Prime 97
-
arithmoi Math.NumberTheory.Primes.IntSet A set of Prime integers.