Skip to content

Commit 8f9269e

Browse files
committed
FIXES: #1666 and conform to alg comment standards
1 parent 98baa86 commit 8f9269e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: Maths/SieveOfEratosthenes.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
/**
2-
* Function to get all prime numbers below a given number
3-
* This function returns an array of prime numbers
4-
* @see {@link https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes}
2+
* @function sieveOfEratosthenes
3+
* @description Function to get all the prime numbers below a given number using sieve of eratosthenes algorithm
4+
* @param {Number} max The limit below which all the primes are required to be
5+
* @returns {Number[]} An array of all the prime numbers below max
6+
* @see [Sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)
7+
* @example
8+
* sieveOfEratosthenes(1) // ====> []
9+
* @example
10+
* sieveOfEratosthenes(20) // ====> [2, 3, 5, 7, 11, 13, 17, 19]
11+
*
512
*/
6-
713
function sieveOfEratosthenes(max) {
814
const sieve = []
915
const primes = []

0 commit comments

Comments
 (0)