Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function primePairs(input) {
- let startFirstCouple = Number(input[0]);
- let startSecondCouple = Number(input[1]);
- let diffFirstCouple = Number(input[2]);
- let diffSecondCouple = Number(input[3]);
- let endFirstCouple = startFirstCouple + diffFirstCouple;
- let endSecondCouple = startSecondCouple + diffSecondCouple;
- for (let i = startFirstCouple; i <= endFirstCouple; i++) {
- for (let j = startSecondCouple; j <= endSecondCouple; j++) {
- let isPrime1 = true;
- let isPrime2 = true;
- for (k = 2; k < i; k++) {
- if (i % k === 0) {
- isPrime1 = false;
- break;
- }
- }
- for (let l = 2; l < j; l++) {
- if (j % l === 0) {
- isPrime2 = false;
- break;
- }
- }
- if (isPrime1 && isPrime2) {
- primeCouple = `${i}${j}`
- console.log(primeCouple);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment