Skip to content

Instantly share code, notes, and snippets.

@radiodario
Last active December 16, 2015 20:49
Show Gist options
  • Save radiodario/5495103 to your computer and use it in GitHub Desktop.
Save radiodario/5495103 to your computer and use it in GitHub Desktop.
Define the symmetric of an integer as the integer obtained by inverting the order of its digits, eg 4321 is the symmetric of 1234. What are the numbers for which the square is equal to the symmetric of the square of the symmetric?
function symmetric(number) {
return parseInt((''+number).split('').reverse().join(''));
}
var i = 0;
while (true) {
if ((""+symmetric(i)).length === (""+i).length) {
if (symmetric(i*i) === (symmetric(Math.pow(symmetric(i), 2))))
console.log(i)
}
i++
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment