Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Найти простые числа в количестве count начиная с start
- */
- function isSimple(num) {
- if (num === 0 || num === 1 || num < 0) return false;
- for (let i = 2; i < num; i++) {
- if (num % i === 0) return false;
- }
- return true;
- }
- function getSimple(start, count) {
- let result = [];
- let i = start;
- do {
- if (isSimple(i)) {
- result.push(i);
- }
- i++;
- } while (result.length < count)
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement