HAN-ASD-DT/rsa/1.1.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/HAN-ASD-DT/rsa is gone (deleted or private); Software Heritage has not archived the repo; no fork with tag 1.1.0 found (60 same-name repos checked); no cached copy. Use another version.

Details

Primes

Provides a lazy, infinite list of primes.

Definition

A lazy list of prime numbers.

type LazyList a

A lazy list. Makes it possible to create infinite lists.

Helpers

take : Int -> LazyList a -> List a

Like List.take but for LazyList.

isPrime : Int -> Bool

Determines if the argument is prime.

The following code snippets will result in the same list. Notice that with the primes example we do not need to know the upper bound.

take 50 primes

returns the same list as

List.filter isPrime <| List.range 2 230

Primality Test

type IsPrime

Type to determine in which category a number falls.

A number is either a Prime, a Composite number or a Probable prime.

Determines if the input is a prime, a composite or a probably prime.

the isPrime function is expansive. Especially for large numbers you want to avoid using it. Instead you want to check if a number is a probably prime.

isProbablyPrime 52439

Will answer Composite <| Just 41