1.0.3 • Published 5 years ago

segmented-sieve-of-eratosthenes-js v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

SegmentedSieveOfEratosthenesJS

Library for efficiently generating big lists of prime numbers.

How to use package

  1. Install package: yarn add segmented-sieve-of-eratosthenes-js
  2. Import needed function: const {primesUntil} = require("segmented-sieve-of-eratosthenes-js")
  3. Use function: primesUntil(10)
  4. Expected output: 3, 5, 7

This will run the segmented algorithm to generate a list of prime numbers until (including) n.

Available scripts

  • print_primes_table $N: Prints a primes table of size (N+1)*(N+1) in the console.
  • test: Runs complete test suite.

Performance tests

These tests were run on a stock i5 6600k (~3.9Ghz Turbo). All primes are generated up until (including) n. Times are in ms.

n10^010^110^210^310^410^510^610^710^8
regular SoE0003227N/AN/AN/AN/A
segmented SoE0000061874,840142,253
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago