arithmoi-0.11.0.0: Efficient basic number-theoretic functions.

Copyright (c) 2018 Alexandre Rodrigues Baldé MIT Alexandre Rodrigues Baldé None Haskell2010

Math.NumberTheory.ArithmeticFunctions.NFreedom

Description

N-free number generation.

Synopsis

# Documentation

Arguments

 :: (Integral a, Bits a, UniqueFactorisation a, Enum (Prime a)) => Word Power n to be used to generate n-free numbers. -> [a] Generated infinite list of n-free numbers.

For a given nonnegative integer power n, generate all n-free numbers in ascending order, starting at 1.

When n is 0 or 1, the resulting list is [1].

Arguments

 :: (Integral a, Bits a, UniqueFactorisation a, Enum (Prime a)) => Word Power n to be used to generate n-free numbers. -> a Starting number in the block. -> Word Maximum length of the block to be generated. -> [a] Generated list of n-free numbers.

Generate n-free numbers in a block starting at a certain value. The length of the list is determined by the value passed in as the third argument. It will be lesser than or equal to this value.

This function should not be used with a negative lower bound. If it is, the result is undefined.

The block length cannot exceed maxBound :: Int, this precondition is not checked.

As with nFrees, passing n = 0, 1 results in an empty list.

Arguments

 :: (Integral a, Enum (Prime a), Bits a, UniqueFactorisation a) => Word Power whose n-freedom will be checked. -> a Lower index of the block. -> Word Length of the block. -> Vector Bool Vector of flags, where True at index i means the i-th element of the block is n-free.

Evaluate the isNFree function over a block. Value at 0, if zero falls into block, is undefined.

This function should **not** be used with a negative lower bound. If it is, the result is undefined. Furthermore, do not:

• use a block length greater than maxBound :: Int.
• use a power that is either of 0, 1.

None of these preconditions are checked, and if any occurs, the result is undefined, if the function terminates.

>>> sieveBlockNFree 2 1 10
[True,True,True,False,True,True,True,False,False,True]