Last active
December 16, 2015 20:49
-
-
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?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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