Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const getGets = (n1) => {
- let inde0 = 0;
- return () => {
- const toReturn = n1[inde0];
- inde0 ++;
- return toReturn;
- };
- };
- // this is the test
- const test = [
- '42 142',
- ];
- const gets = this.gets || getGets(test);
- const print = this.print || console.log;
- let n = gets().split(' ');
- let arr = [];
- let result = [];
- let A = +n[0];
- let B = +n[1];
- for (i = A; i <= B; i++) {
- arr.push(i);
- }
- for(i = 0; i < arr.length; i++) {
- let num = [...arr[i]+''].filter(Number).map(n=>parseInt(n));;
- let len = num.length;
- for(k = 0; k <= len; k++) {
- if (arr[i] % num[k] == 0 && arr[i] % num[k+1] == 0) {
- result.push(arr[i]);
- }
- }
- }
- uniq = [...new Set(result)];
- print(uniq.length);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement