Skip to content

Instantly share code, notes, and snippets.

@clauswitt
Created May 29, 2010 19:20
Show Gist options
  • Save clauswitt/418472 to your computer and use it in GitHub Desktop.
Save clauswitt/418472 to your computer and use it in GitHub Desktop.
var sys = require('sys');
var Euler4 = function() {
var isPalindromicNumber = function(num) {
var digitString = num.toString();
var reverseString = digitString.split('').reverse().join('');
return (digitString==reverseString);
}
var getResult = function() {
result = 0;
res = 0;
for(var i=999;i>99;i--) {
for(var j=999;j>99;j--) {
if(j<i) break;
res = j*i;
if(isPalindromicNumber(res)) {
if(res>result) {
result = res;
};
break;
}
}
}
sys.puts('Result: ' + result);
}
getResult()
};
new Euler4();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment