Created
September 7, 2018 04:42
-
-
Save hillal20/49385c8155b5e02cdb5697fb1ab4a971 to your computer and use it in GitHub Desktop.
SereneCrimsonVoxel-1 created by hillal20 - https://repl.it/@hillal20/SereneCrimsonVoxel-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let geant = (a,b)=>{ | |
let big = (x)=>{ | |
let bill = (x)=>{ | |
let fill = [] | |
for ( let i = 0 ; i <= x; i ++){ | |
if ( x % i === 0 ){ | |
fill.push(i) | |
} | |
} | |
return fill; | |
} | |
let result = bill(x) | |
let a = 1 | |
let arr = [] | |
let dill = ( result , x )=>{ | |
if ( a === result.length ){ | |
return arr; | |
} | |
if ( x === 1 ){ | |
return arr; | |
} | |
if( x % result[a] === 0 ){ | |
arr.push(result[a]) | |
x = x/result[a] | |
dill(result, x ) | |
} | |
else{ | |
a++ | |
dill( result , x ) | |
} | |
} | |
dill( result, x) | |
return arr; | |
} | |
const A = big(a) | |
const B = big(b) | |
const newArr = []; | |
for( let i = 0 ; i < A.length; i ++){ | |
if( B.includes(A[i]) && !newArr.includes(A[i])){ | |
newArr.push(A[i]) | |
} | |
} | |
let total = 1; | |
for( let i = 0 ; i < newArr.length; i ++){ | |
total *= newArr[i] | |
} | |
return total | |
} | |
const final = geant(90,30) | |
console.log(final) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment