2.0.14 • Published 3 years ago
@algorithm.ts/sieve-totient v2.0.14
A typescript implementation of the Linear Sieve algorithm for primes numbers and Euler's totient function.
If you are curious about this algorithm, you can visit here for more details.
Install
npm
npm install --save @algorithm.ts/sieve-totient
yarn
yarn add @algorithm.ts/sieve-totient
deno
import sieveTotient from 'https://raw.githubusercontent.com/guanghechen/algorithm.ts/main/packages/sieve-totient/src/index.ts'
Usage
Get all prime numbers and totient function values in the range $[2, N)$:
import sieveTotient from '@algorithm.ts/sieve-totient' const [totients, primes] = sieveTotient(10) // => // totients: [0, 1, 1, 2, 2, 4, 2, 6, 4, 6] // primes: [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