math-primes 0.1.0

Some utilities related to prime numbers


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

A prime-number library for D

This module implements an infinite-primes range, and not much else.

gmp-d is efficient and fast but can't be used at compile-time.

bench/results.org has some simple benchmarks.

usage

Add it as a dub dependency and consult the documentation. Here's a script that prints the first 50 primes:

#! /usr/bin/env dub
/+ dub.sdl:
    dependency "math-primes" version="~>0.1.0"
+/

void main() {
    import math.primes: Sieve, nthPrimeUpperBound;
    import std.stdio: writeln;
    import std.range: take;

    foreach (p; Sieve!int(nthPrimeUpperBound(50)).take(50))
        writeln(p);
}
Authors:
  • Julian Fondren
Dependencies:
none
Versions:
0.1.1 2019-Dec-06
0.1.0 2019-Nov-24
~master 2019-Dec-06
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 17 downloads total

Score:
0.5
Short URL:
math-primes.dub.pm