Script solution for finding a product problem:
Answer: 30
console.log("----------------------------------");
function somfun(a,b,c){
var num = ((a*b)-1)*((b*c)-1)*((c*a)-1);
var den = a*b*c;
if(num % den === 0){
return true;
} else {
return false;
}
}
var max=100;
for(var i=2; i<=max; i++){
for(var j=2; j<=max; j++){
for(var k=2; k<=max; k++){
if(somfun(i,j,k)){
var temp = i*j*k;
console.log(i+" "+j+" "+k+" "+temp);
}
}
}
}
No comments:
Post a Comment