Copyright | (c) 2018 Alexandre Rodrigues Baldé |
---|---|

License | MIT |

Maintainer | Alexandre Rodrigues Baldé <alexandrer_b@outlook.com> |

Safe Haskell | None |

Language | Haskell2010 |

N-free number generation.

## Synopsis

- nFrees :: forall a. (Integral a, Bits a, UniqueFactorisation a, Enum (Prime a)) => Word -> [a]
- nFreesBlock :: forall a. (Integral a, Bits a, UniqueFactorisation a, Enum (Prime a)) => Word -> a -> Word -> [a]
- sieveBlockNFree :: forall a. (Integral a, Enum (Prime a), Bits a, UniqueFactorisation a) => Word -> a -> Word -> Vector Bool

# Documentation

:: (Integral a, Bits a, UniqueFactorisation a, Enum (Prime a)) | |

=> Word | Power |

-> [a] | Generated infinite list of |

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

.

:: (Integral a, Bits a, UniqueFactorisation a, Enum (Prime a)) | |

=> Word | Power |

-> a | Starting number in the block. |

-> Word | Maximum length of the block to be generated. |

-> [a] | Generated list of |

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.

:: (Integral a, Enum (Prime a), Bits a, UniqueFactorisation a) | |

=> Word | Power whose |

-> a | Lower index of the block. |

-> Word | Length of the block. |

-> Vector Bool | Vector of flags, where |

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.

`>>>`

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