Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve() {
- return function(a, b) {
- let array = new Array();
- let isPrime = true;
- for (let i = a; i <= b; i += 1) {
- for (let j = 2; j < i; j += 1) {
- if (i % j === 0) {
- isPrime = false;
- }
- }
- if (isPrime && i !== 1) {
- array.push(i);
- }
- isPrime = true;
- }
- return array;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment