Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function uniquePinCodes(input) {
- let one = Number(input.shift());
- let two = Number(input.shift());
- let three = Number(input.shift());
- let prime = true;
- let result = "";
- for (let a = 1; a <= one; a++) {
- for (let b = 1; b <= two; b++) {
- let maxDivider = Math.sqrt(b);
- for (let m = 2; m <= maxDivider; m++) {
- if (b % m == 0) {
- prime = false;
- } else {
- prime = true;
- }
- }
- for (let c = 1; c <= three; c++) {
- if ((a % 2 == 0) && (prime == true && b > 1) && (c % 2 == 0)) {
- result += `${a} ${b} ${c}\n`;
- }
- }
- }
- }
- console.log(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment