View Source Primacy (Primacy v0.1.0)

Prime number handling of various sorts

Summary

Functions

Prime check.

Generate a list of primes near a given number

Functions

Prime check.

Examples

iex> Primacy.is_prime?(61)
true

iex> Primacy.is_prime?(62)
false
Link to this function

primes_near(n, opts \\ [])

View Source

Generate a list of primes near a given number

Options:

  • count: how long a list to produce? (default: 1)
  • dir: :below, :above, :around (default: :around)

Examples

iex> Primacy.primes_near(600)
[601]

iex> Primacy.primes_near(600, count: 10)
[571, 577, 587, 593, 599, 601, 607, 613, 617, 619]

iex> Primacy.primes_near(600, count: 10, dir: :below)
[541, 547, 557, 563, 569, 571, 577, 587, 593, 599]