real-dice-0.1.0.4: Random number generation based on physical media touched by humans
Safe HaskellSafe-Inferred
LanguageHaskell2010

RealDice.Util.Prime

Description

Module for finding the greatest prime number that is less than or equal to a given number

Synopsis

Documentation

greatestPrimeNotGreaterThan :: Int -> Int Source #

Returns the greatest prime number that is not greater than the given number

Returns 1 if called with the number 1

Returns 0 if called with a number lower than 1

See RealDice.Generate.RawData for reasons for use in this package

Examples

Expand
>>> greatestPrimeNotGreaterThan 10
7
>>> greatestPrimeNotGreaterThan 1024
1021
>>> greatestPrimeNotGreaterThan 1
1
>>> greatestPrimeNotGreaterThan 0
0
>>> greatestPrimeNotGreaterThan (-1024)
0