Last active
October 16, 2021 16:52
-
-
Save vitaly-t/280c6f925c1c2d7e55be609ee0fe938e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {generatePrimes} from 'primes-generator'; | |
| // there are 1,270,607 primes in the first 20mln: | |
| const iterator = generatePrimes({boost: 1_270_607}); | |
| let a, lastValue = 0, count = 0; | |
| const start = Date.now(); | |
| do { | |
| a = iterator.next(); | |
| if (a.done) { | |
| break; | |
| } | |
| count++; | |
| lastValue = a.value; | |
| } while (true); | |
| console.log(`Duration: ${Date.now() - start}, count: ${count}, last prime: ${lastValue}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment