You are on page 1of 2

For this question, I first used coding on javascript to find out the answer to the

problem
Code:
function get_highest_palindrome(high, low) {
var highest = 0;
for(var i = high; i >= low; i--) {
for(var j = high; j >= low; j--) {
sum = i * j;
if(sum <= highest) {
break;
}
if(is_palindrome(sum.toString())) {
highest = max(highest, sum);
}
}
}
return highest;
}
function reverse(string) {
var array = string.split('').reverse();
var out = '';
for(key in array) {
out += array[key];
}
return out;
}
function max(a,b) {
if(a > b) {
return a;
}
return b;
}
function is_palindrome(string) {
return string == reverse(string);
}
print(get_highest_palindrome(999, 100));

I got the answer of 906609


Now I used guess and check to find out the divisors of 906609

Divisor 1

Divisor 2

Result

Palindrome
/ 906609 ?

999

999

998001

No

999

998

997002

No

999

997

996003

No

999

996

995004

No

O
O
O
O
993

913

906609

Yes

You might also like