Skip to content

Instantly share code, notes, and snippets.

@jakedobkin
Created November 11, 2011 18:32
Show Gist options
  • Save jakedobkin/1358798 to your computer and use it in GitHub Desktop.
Save jakedobkin/1358798 to your computer and use it in GitHub Desktop.
Euler Problem 4
<html>
<body>
<script type="text/javascript">
total = 0;
for (i=100;i<=999;i++)
{
for (j=100;j<=999;j++)
{
k = i * j;
// we only want to check candidates if they are larger than our largest total yet
if(k > total)
{
k = k.toString();
if (k.charAt(0) == k.charAt(5) && k.charAt(1) == k.charAt(4) && k.charAt(2) == k.charAt(3))
{
total = k;
}
}
}
}
document.write(total + " is highest palindrome which is also the product of two three digit numbers<br/>")
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment