Skip to content

Implement prime number functions #1591

@stylewarning

Description

@stylewarning

Probably in a new package coalton-librar/math/primes.

Implement the following new prime number routines on Integral instances:

  • (prime? x) which uses a deterministic primality test like AKS
  • (miller-rabin-prime? n x) which does the Miller-Rabin test n times. Documentation should give a false-positive bound from n.
  • (probable-prime? x) which uses Miller-Rabin for a suitable default n.
  • (primes) which returns an iterator for all primes (perhaps using techniques from here).
  • (coprime? a b) which checks coprimality of a and b
  • (factorize n) which returns a sequence of prime factors of n

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions