2.0.14 • Published 3 years ago

@algorithm.ts/sieve-prime v2.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

A typescript implementation of the Linear Sieve algorithm for prime numbers.

If you are curious about this algorithm, you can visit here for more details.

Install

  • npm

    npm install --save @algorithm.ts/sieve-prime
  • yarn

    yarn add @algorithm.ts/sieve-prime
  • deno

    import sievePrime from 'https://raw.githubusercontent.com/guanghechen/algorithm.ts/main/packages/sieve-prime/src/index.ts'

Usage

  • Get all prime numbers in the range $[2, N)$:

    import sievePrime from '@algorithm.ts/sieve-prime'
    
    sievePrime(5)   // => [2, 3]
    sievePrime(6)   // => [2, 3, 5]
    sievePrime(10)   // => [2, 3, 5, 7]

Related

2.0.14

3 years ago

2.0.13

3 years ago

2.0.12

3 years ago

2.0.8-alpha.0

3 years ago

2.0.7-alpha.1

3 years ago

2.0.7-alpha.0

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.11

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.0-alpha.0

3 years ago

2.0.1

3 years ago

1.0.24

3 years ago

2.0.0

3 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago